# Comparing two workdates to return the latest date.

• 0
• Question
• Updated 2 years ago
I have a project management app that uses predecessors.  There are two possible outcomes in my workflow where I want to compare two different task completion dates and use the highest as the project finish date.
I created two summary fields based on my two possible task completion dates (work dates).  Then I created a formula date field to show the result of the comparison.  I was trying to use the MAX function:

MAX([summary date 1],[summary date 2])

I am getting a syntax error, and I have had no luck rearranging the components of the formula.  Has anyone else used MAX on work dates?
• 90 Points

Posted 2 years ago

• 0
• 72,488 Points
What is the syntax error - but aside from that, try thisd

Max(ToDate([summary date 1], ToDate([summary date 2]))

Maybe those summary fields are Work date field types.
• 90 Points

Good Morning!

Now the error is a mismatched set of parenthesis....

Max(ToDate([Summary 2 of Final task date completed], ToDate([Summary of final task date completed]))

Yes, Both of the Summary dates are WorkDates.

• 72,488 Points
Try this

Max(
ToDate([Summary 2 of Final task date completed]), ToDate([Summary of final task date completed])
)
• 90 Points
It accepted that formula, Thank you!  However it is returning the earlier date.  One task was completed on 10-12-16 the other was completed on 1-30-17.  This field now shows 10-12-16.  Any thoughts?
• 72,488 Points
Can you tell me what dates are in each of those two fields?
• 90 Points
Summary of final task date completed = 1/30/17,  Summary 2...= 10/12/16
• 90 Points
Never mind, just as I suspected, that problem is on my end.  Has to do with where they are pointed. Thank you so much for the help with the formula!  When I fix the background it should work like a charm.
• 72,488 Points
:)  Great.