Match Function

  • Thread starter Thread starter Melanie
  • Start date Start date
M

Melanie

Hi,
I have put together a spreadsheet to find codes, states, descriptions. It
finds the data by dates.
Columns are: Dates, Codes, States, Descriptions
If I put in a date it matches the code, state and description.

My problem is that if I have 2 dates that are the same it will only match
the first date it can find. What kind of formula do I need so that it will
output the second or third date data.

Thanks for your help.
If you need a copy of the spreadsheet please let me know.
 
One way...

Assume your data is in the range A2:D500

F2:H2 = headers: Code, State, Description

F1 = lookup date

Enter this formula in G1. This will return the count of dates based on the
date entered in cell F1:

=COUNTIF(A:A,F1)

Enter this array formula** in F3:

=IF(ROWS(F$3:F3)<=$G$1,INDEX(B$2:B$500,SMALL(IF($A$2:$A$500=$F$1,ROW(B$2:B$500)),ROWS(F$3:F3))-ROW(B$2)+1),"")

** array formulas need to be entered using the key combination of
CTRL,SHIFT,ENTER (not just ENTER). Hold down both the CTRL key and the SHIFT
key then hit ENTER.

Copy across to H3 then down to a number of rows that ensures you get all the
results. How many rows that is depends on the maximum count for any single
date. For example, if 1/1/2009 appears the most times, let's say it appears
5 times, then you need to copy the formula to at least 5 rows.
 
I put the formulas in and the count works but the second formula gives me a
#Value Error.
 
Back
Top