# Index Match along with SMALL and COUNTIF

##### Well-known Member
Hello Guys,
I got a three formulae that return results from another worksheet. One of these is working alright - the one that returns the dates. But the two other are not working. I am posting a portion here. Any help is appreciated and THANKS in advance.
Excel Workbook
ABCD
1LAST NAMEFIRST NAMEDC Exp date31/12/2012
2
3#NUM!#NUM!10/07/2008
4#NUM!#NUM!10/07/2008
5#NUM!#NUM!10/07/2008
 DC

##### Well-known Member
OK
I will post another sample where another formula is working but it is giving me the same result for same date in three different cells. I would like to get three right results which will be different person name in all three cases.
Excel Workbook
ABCDEF
1LAST NAMEFIRST NAMEDC Exp date31/12/2012
2#NUM!#NUM!26/03/2008BOGDANOVIC
3#NUM!#NUM!10/07/2008SIPILIANO
4
5#NUM!#NUM!10/07/2008SIPILIANO
 DC

##### Well-known Member
I worked it out myself, so no need of any solutions now. Thanks anyway to anyone who may have tried to solve it for me.

#### T. Valko

##### Well-known Member
I worked it out myself, so no need of any solutions now. Thanks anyway to anyone who may have tried to solve it for me.
OK, glad you got it worked out. Here's a tip that'll save you a few keystrokes when dealing with complex formulas like those:

=IF(ISERROR(INDEX(Details!\$C\$2:\$R\$40,MATCH(\$C4,Details!R\$2:R\$40,0),3)),"",SMALL(INDEX(Details!\$C\$2:\$R\$40,MATCH(\$C4,Details!R\$2:R\$40,0),3),COUNTIF(C\$2:C4,C4)))

When error trapping, the portion of the formula that will actually cause an error is the MATCH function so you can leave out the INDEX portion:

=IF(ISERROR(MATCH(\$C4,Details!R\$2:R\$40,0)),"",SMALL(INDEX(Details!\$C\$2:\$R\$40,MATCH(\$C4,Details!R\$2:R\$40,0),3),COUNTIF(C\$2:C4,C4)))

Or, since the MATCH function generates an #N/A error:

=IF(ISNA(MATCH(\$C4,Details!R\$2:R\$40,0)),"",SMALL(INDEX(Details!\$C\$2:\$R\$40,MATCH(\$C4,Details!R\$2:R\$40,0),3),COUNTIF(C\$2:C4,C4)))

Or,

=IF(COUNTIF(Details!R\$2:R\$40,\$C4),SMALL(INDEX(Details!\$C\$2:\$R\$40,MATCH(\$C4,Details!R\$2:R\$40,0),3),COUNTIF(C\$2:C4,C4)),"")

##### Well-known Member
Thanks #NAME for your tips. I will try to memorise them for my other formulae as well. Thanks again

You're welcome!

1,082,109
Messages
5,363,193
Members
400,721
Latest member
eileen123

### This Week's Hot Topics

• populate from drop list with multiple tables
Hi All, i have a drop list that displays data, what i want is when i select one of those from the list to populate text from different tables on...
• Find list of words from sheet2 in sheet1 before a comma and extract text vba
Hi Friends, Trying to find the solution on my task. But did not find suitable one to the need. Here is my query and sample file with details...
• Dynamic Formula entry - VBA code sought
Hello, really hope one of you experts can help with this - i've spent hours on this and getting no-where. .I have a set of data (more rows than...