Extract multiple matches into separate rows

jordiejones

New Member
Hello world.
I'm having an issue where I have and index and match with multiple return values but running into problems.
Here's my setup:

A B C D E
1
2 10A
3 [first]
4 [2nd]
5 [3rd]
6 [4th]

=IFERROR(INDEX('BETA Care Plans'!$B$1:$B$215,SMALL(IF('BETA Care Plans'!$A$1:$A$215=A$2,ROW('BETA Care Plans'!$A$1:$A$215)-MIN(ROW('BETA Care Plans'!$A$1:$A$215))+1),ROWS($A$3:A3))),"")

I'm trying to index and match the value in A2 to another sheet and return all matching values rather than the first matching value.

Only thing I can think of causing problems:
The text values in the other sheet come from formulas as well
Some of the values have a " " at the start of the text

=IFERROR(INDEX('BETA Care Plans'!$B$1:$B$215,SMALL(IF('BETA Care Plans'!$A$1:$A$215=A$2,ROW('BETA Care Plans'!$A$1:$A$215)-MIN(ROW('BETA Care Plans'!$A$1:$A$215))+1),ROWS($A$3:A3))),"")

when I enter this without the array, it returns the second returned value and nothing else. When I enter as array it returns "". when I remove the IFERROR, it returns #NUM .

any help would be greatly appreciated.
 

Toadstool

Active Member
The use of SMALL means this should be entered as an array formula with Ctrl-Shift-Enter to get the curly brackets.

If your BETA Care Plans looks like this:
Header1Data1
10A10A - 1
10A10A - 2
20B20B - 1
10A10A - 3
10A10A - 4
10A10A - 5
10A10A - 6
10A10A - 7
10A10A - 8
10A10A - 9
10A10A - 10

<tbody>
</tbody>

The you can change the last A3 to A4 to skip the first match
A
1Result
210A
310A - 2
410A - 3
510A - 4
610A - 5
710A - 6
810A - 7
910A - 8
1010A - 9
1110A - 10

<colgroup><col style="width: 25pxpx"><col></colgroup><thead>
</thead><tbody>
</tbody>
Sheet1

Array Formulas
CellFormula
A3
{=IFERROR(INDEX('BETA Care Plans'!$B$1:$B$215,SMALL(IF('BETA Care Plans'!$A$1:$A$215=A$2,ROW('BETA Care Plans'!$A$1:$A$215)-MIN(ROW('BETA Care Plans'!$A$1:$A$215))+1),ROWS($A$3:A4))),"")}

<thead>
</thead><tbody>
</tbody>
Entered with Ctrl+Shift+Enter. If entered correctly, Excel will surround with curly braces {}.
Note: Do not try and enter the {} manually yourself

<tbody>
</tbody>

Is this what you were trying to do?
 

Some videos you may like

This Week's Hot Topics

  • Importing multiple excel files into one spreadsheet
    Hi, I'm trying to import multiple excel files (with the same format into a single spreadsheet) so that each day's file is listed underneath the...
  • find many based on a certain criteria
    good evening, I hope someone can help me? I have a workbook sheet 2 contains lots of data.... I would like to be able to find anything on sheet...
  • How to copy multiple rows using If
    Hi all, I'm very new to VBA and have written this simple code to copy certain cells if a certain cell within that row contains any data. I need...
  • VBA If statement
    Dear All, I have two dates, where I'd like a message box to pop, if the dates are between this criteria. [CODE] sDate1 = #10/1/2019#...
  • Text Format
    I have a sheet for user to keyin the data. The format of the data can be 451 / 1903, 0012 / 9908 or 00287 / 0099. The number after the "/" is...
  • Macro to copy values across rows and transposing them and add the user id
    [FONT=Times New Roman][SIZE=3][COLOR=#000000][/COLOR][/SIZE][/FONT][FONT=Calibri][SIZE=3][COLOR=#000000]Hi,[/COLOR][/SIZE][/FONT] [FONT=Times New...
Top