Finding the highest date in Column B for all occurrences of a specified string in Column D

I need a formula or function that finds all matches for a given string in one column, then looks at the corresponding dates in another column and returns the highest date that is NOT higher than the date in G1.

Please take a look at the attached workbook. I had a formula that seemed to work but apparently not as you can see in the workbook.

gabrielPennybackReliability Business Tools Analyst IIAsked:
Who is Participating?
barry houdiniConnect With a Mentor Commented:
Hello John,

Your existing LOOKUP formula will work accurately only if the data is sorted (ascending) by the date column, as it finds the last match for your criteria that will also be the MAX if sorted....

If unsorted then I recommend this "array formula"


confirmed with CTRL+SHIFT+ENTER

see attached

regards, barry
StephenJRConnect With a Mentor Commented:
How about this ARRAY formula?

barry houdiniCommented:
Hello John,

Generically you can use a formula like this


Array entered.....

where strings are in A and dates in B with specific string to match in D1

regards, barry
Get your problem seen by more experts

Be seen. Boost your question’s priority for more expert views and faster solutions

barry houdiniCommented:
Hello John, are you looking for a date? That's what your description says but your formula in J5 is returning a value from column C...not a date?

Assuming you do want a date then using the setup I suggested above but adjusted for your specific ranges you get


format result cell as


....then if there is no match you'll get a blank

Stephen's formula will give the same result in this case and possibly others but if all the dates for the qualifying rows were greater than the cutoff date my formula returns a blank/zero while Stephen's returns the cutoff date
gabrielPennybackReliability Business Tools Analyst IIAuthor Commented:
My typo, sorry about that. What I'm looking for is the value in Column C corresponding to the highest date (in Column B) associated with the three 27613's in Column D.

I tried customizing your formulas, both of which work, but I couldn't figure it out. Could you re-post the workbook with a working example?

gabrielPennybackReliability Business Tools Analyst IIAuthor Commented:
Thanks Barry, that really does the trick. I wanted to give Stephen some points for giving me the solution I inadvertently asked for!

- John
Thanks John!
Question has a verified solution.

Are you are experiencing a similar issue? Get a personalized answer when you ask a related question.

Have a better answer? Share it in a comment.

All Courses

From novice to tech pro — start learning today.