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

Posted on 2011-09-28
Last Modified: 2012-05-12
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.

Question by:gabrielPennyback
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
  • 3
  • 2
  • 2
LVL 24

Assisted Solution

StephenJR earned 125 total points
ID: 36718545
How about this ARRAY formula?

LVL 50

Expert Comment

by:barry houdini
ID: 36718558
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
LVL 50

Expert Comment

by:barry houdini
ID: 36718889
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
Instantly Create Instructional Tutorials

Contextual Guidance at the moment of need helps your employees adopt to new software or processes instantly. Boost knowledge retention and employee engagement step-by-step with one easy solution.


Author Comment

ID: 36720241
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?

LVL 50

Accepted Solution

barry houdini earned 375 total points
ID: 36720549
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

Author Closing Comment

ID: 36751497
Thanks Barry, that really does the trick. I wanted to give Stephen some points for giving me the solution I inadvertently asked for!

- John
LVL 24

Expert Comment

ID: 36813522
Thanks John!

Featured Post

Free Tool: Port Scanner

Check which ports are open to the outside world. Helps make sure that your firewall rules are working as intended.

One of a set of tools we are providing to everyone as a way of saying thank you for being a part of the community.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Suggested Solutions

Title # Comments Views Activity
Excel compare strings 6 55
Combining match and vlookup??? 4 32
Resolving #VALUE error in spreadsheet 2 23
Need to count  the pair 35 23
Introduction This Article briefly covers methods of calculating the NPV and IRR variants in Excel as well as the limitations in calculating and interpreting IRR results. Paraphrasing Richard Shockley, author of my favourite finance reference tex…
This article will guide you to convert a grid from a picture into Excel format using Microsoft OneNote and no other 3rd party application.
This Micro Tutorial will demonstrate on a Mac how to change the sort order for chart legend values and decrpyt the intimidating chart menu.
This Micro Tutorial will demonstrate in Google Sheets how to use the HYPERLINK function to create live links inside your spreadsheet.

751 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question