Solved

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

Posted on 2011-09-28
7
206 Views
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.

Thanks,
John
FindTailByDate-v2.xls
0
Comment
Question by:gabrielPennyback
  • 3
  • 2
  • 2
7 Comments
 
LVL 24

Assisted Solution

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

=MIN(CutOffDate,MAX(IF(LKP_SN=F5,LKP_EIS)))
0
 
LVL 50

Expert Comment

by:barry houdini
ID: 36718558
Hello John,

Generically you can use a formula like this

=MAX(IF(A1:A100=D1,IF(B1:B100<=G1,B1:B100)))

Array entered.....

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

regards, barry
0
 
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

=MAX(IF(LKP_SN=F5,IF(LKP_EIS<=G1,LKP_EIS)))

format result cell as

mm/dd/yyyy;;

....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
0
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.

 
LVL 1

Author Comment

by:gabrielPennyback
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?

Thanks!
John
0
 
LVL 50

Accepted Solution

by:
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"

=INDEX(LKP_Tails,MATCH(1,(LKP_EIS=MAX(IF((LKP_SN=F5)*(LKP_EIS<=CutOffDate),LKP_EIS)))*(LKP_SN=F5),0))

confirmed with CTRL+SHIFT+ENTER

see attached

regards, barry
27346272.xls
0
 
LVL 1

Author Closing Comment

by:gabrielPennyback
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
0
 
LVL 24

Expert Comment

by:StephenJR
ID: 36813522
Thanks John!
0

Featured Post

Announcing the Most Valuable Experts of 2016

MVEs are more concerned with the satisfaction of those they help than with the considerable points they can earn. They are the types of people you feel privileged to call colleagues. Join us in honoring this amazing group of Experts.

Question has a verified solution.

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

Suggested Solutions

Title # Comments Views Activity
question about excel functionality 3 34
V-Lookup 11 21
Excel 2010 Pivot Table Calculated Fields 2 15
Create Dynamic Range Via VBA 9 18
This tutorial explains how to create a series of drop-down lists that are dependent upon prior selections to guide (“force”) the user to make the correct selection and reduce data errors within Microsoft Excel. Excel 2010 was used for this tutorial;…
Freeze panes is an option within all variants of Excel to enable parts of a sheet to remain stationary when the cursor is in another part of the sheet. This is a very useful feature which is overlooked or under used.
The viewer will learn how to use a discrete random variable to simulate the return on an investment over a period of years, create a Monte Carlo simulation using the discrete random variable, and create a graph to represent the possible returns over…
The viewer will learn how to create a normally distributed random variable in Excel, use a normal distribution to simulate the return on an investment over a period of years, Create a Monte Carlo simulation using a normal random variable, and calcul…

820 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