Using Index function with multiple criteria

trone77

Board Regular
Joined
Dec 28, 2009
Messages
152
Office Version
  1. 2019
Platform
  1. Windows
I am currently using the following formula to extract from the columns below on the left containing various 3 digit numbers:

{=IFERROR(INDEX(B$1:B$21,SMALL(IF($B$1:$B$21=$H$3,ROW($B$1:$B$21)),ROW(1:1))),"")}
So in the first example I am looking for the value of 1 for the first digit and extract the full 3 digit string which returns the 124, 118, 103.

{=IFERROR(INDEX(C$1:C$21,SMALL(IF($C$1:$C$21=$I$10,ROW($C$1:$C$21)),ROW(1:1))),"")}
Same for the second digit being 5 which returns 657, 555, 259 for the second example.

But what I am looking to accomplish is to implement a second criteria using the above formulas. So in the example using the value of 3(1st) digit and 4(2nd) digit to return the final number in the string which would be 347, 340, 341.


ABCDEFGHIJKLMNOP
31241__34_
4347
565711241347
627321182340
711831033341
8002
9703
10555_5__24
11259
1243016571124
1377225552424
1442432593724
15222
16103
17713__27_3
18340
1972410021703
2078327722713
2134132223783

<colgroup><col span="6"><col><col span="9"></colgroup><tbody>
</tbody>
 

Excel Facts

What does custom number format of ;;; mean?
Three semi-colons will hide the value in the cell. Although most people use white font instead.
I have changed the format. Can you work with this:


Book1
ABCDEFGHIJ
1Criteria_1Criteria_2Criteria_3
21241__124
3347118
4657103
527334_347
6118340
7002341
8703_5_657
9555555
10259259
11430_24124
12772424
13424724
14222__2002
15103772
16713222
173407_3703
18724713
19783783
20341
Sheet11
Cell Formulas
RangeFormula
H2{=IFERROR(INDEX(A$2:A$20,SMALL(IF(ISNUMBER(SEARCH(SUBSTITUTE(INDEX($E$1:E2&$F$1:F2&$G$1:G2,MAX(IF(E$1:E2<>"",ROW(E$1:E2)-ROW($E$1)+1))),"_","?"),$A$2:$A$20&$B$2:$B$20&$C$2:$C$20)),(ROW($A$2:$A$20)-ROW($A$2)+1)),ROWS(INDEX(H$1:H2,MAX(IF(E$1:E2<>"",ROW(E$1:E2)-ROW($E$1)+1))):H2))),"")}
Press CTRL+SHIFT+ENTER to enter array formulas.
 
Upvote 0
Ok how about this, what formula would I need to accomplish just this:

ABCDEFGHIJKLMNOP
312434_
4347
56571347
62732340
71183341
8002
9703
10555
11259
12430
13772
14424
15222
16103
17713
18340
19724
20783
21341

<colgroup><col span="6"><col><col span="9"></colgroup><tbody>
</tbody>
 
Upvote 0

Forum statistics

Threads
1,214,641
Messages
6,120,693
Members
448,979
Latest member
DET4492

We've detected that you are using an adblocker.

We have a great community of people providing Excel help here, but the hosting costs are enormous. You can help keep this site running by allowing ads on MrExcel.com.
Allow Ads at MrExcel

Which adblocker are you using?

Disable AdBlock

Follow these easy steps to disable AdBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the icon in the browser’s toolbar.
2)Click on the "Pause on this site" option.
Go back

Disable AdBlock Plus

Follow these easy steps to disable AdBlock Plus

1)Click on the icon in the browser’s toolbar.
2)Click on the toggle to disable it for "mrexcel.com".
Go back

Disable uBlock Origin

Follow these easy steps to disable uBlock Origin

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back

Disable uBlock

Follow these easy steps to disable uBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back
Back
Top