Index

trone77

Board Regular
Joined
Dec 28, 2009
Messages
152
Office Version
  1. 2019
Platform
  1. Windows
Looking for a formula that can extract from columns B, C and D every time the value 3 appears in column B & 4 appears in column C.


The previous formula used was: {=IFERROR(INDEX(B$1:B$21,SMALL(IF($B$1:$B$21=$N$3,ROW($B$1:$B$21)),ROW(1:1))),"")}

Which only dealt with one criteria, and in this instance would have only returned every 3 digit string that had the value of 3 in the C column, however I am looking implement a second criteria in to the formula like the example below.



[TABLE="class: cms_table, width: 514"]
<tbody>[TR]
[TD]A[/TD]
[TD]B[/TD]
[TD]C[/TD]
[TD]D[/TD]
[TD]E[/TD]
[TD]F[/TD]
[TD]G[/TD]
[TD]H[/TD]
[TD]I[/TD]
[TD]J[/TD]
[TD]K[/TD]
[TD]L[/TD]
[TD]M[/TD]
[TD]N[/TD]
[TD]O[/TD]
[TD]P[/TD]
[/TR]
[TR]
[TD][/TD]
[TD][/TD]
[TD][/TD]
[TD][/TD]
[TD][/TD]
[TD][/TD]
[TD][/TD]
[TD][/TD]
[TD][/TD]
[TD][/TD]
[TD][/TD]
[TD][/TD]
[TD][/TD]
[TD][/TD]
[TD][/TD]
[TD][/TD]
[/TR]
[TR]
[TD]3[/TD]
[TD]1[/TD]
[TD]2[/TD]
[TD]4[/TD]
[TD][/TD]
[TD][/TD]
[TD][/TD]
[TD][/TD]
[TD][/TD]
[TD][/TD]
[TD][/TD]
[TD][/TD]
[TD][/TD]
[TD]3[/TD]
[TD]4[/TD]
[TD]_[/TD]
[/TR]
[TR]
[TD]4[/TD]
[TD]3[/TD]
[TD]4[/TD]
[TD]7[/TD]
[TD][/TD]
[TD][/TD]
[TD][/TD]
[TD][/TD]
[TD][/TD]
[TD][/TD]
[TD][/TD]
[TD][/TD]
[TD][/TD]
[TD][/TD]
[TD][/TD]
[TD][/TD]
[/TR]
[TR]
[TD]5[/TD]
[TD]6[/TD]
[TD]5[/TD]
[TD]7[/TD]
[TD][/TD]
[TD][/TD]
[TD][/TD]
[TD][/TD]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]
[TD][/TD]
[/TR]
[TR]
[TD]18[/TD]
[TD]3[/TD]
[TD]4[/TD]
[TD]0[/TD]
[TD][/TD]
[TD][/TD]
[TD][/TD]
[TD][/TD]
[TD][/TD]
[TD][/TD]
[TD][/TD]
[TD][/TD]
[TD][/TD]
[TD][/TD]
[TD][/TD]
[TD][/TD]
[/TR]
[TR]
[TD]19[/TD]
[TD]7[/TD]
[TD]2[/TD]
[TD]4[/TD]
[TD][/TD]
[TD][/TD]
[TD][/TD]
[TD][/TD]
[TD][/TD]
[TD][/TD]
[TD][/TD]
[TD][/TD]
[TD][/TD]
[TD][/TD]
[TD][/TD]
[TD][/TD]
[/TR]
[TR]
[TD]20[/TD]
[TD]7[/TD]
[TD]8[/TD]
[TD]3[/TD]
[TD][/TD]
[TD][/TD]
[TD][/TD]
[TD][/TD]
[TD][/TD]
[TD][/TD]
[TD][/TD]
[TD][/TD]
[TD][/TD]
[TD][/TD]
[TD][/TD]
[TD][/TD]
[/TR]
[TR]
[TD="bgcolor: #FAFAFA"]21[/TD]
[TD="bgcolor: #FAFAFA"]3[/TD]
[TD="bgcolor: #FAFAFA"]4[/TD]
[TD="bgcolor: #FAFAFA"]1[/TD]
[/TR]
</tbody>[/TABLE]
 
Last edited:

Excel Facts

Square and cube roots
The =SQRT(25) is a square root. For a cube root, use =125^(1/3). For a fourth root, use =625^(1/4).
How about
=INDEX($D$3:$D$21,AGGREGATE(15,6,(ROW($D$3:$D$21)-ROW($D$3)+1)/(($B$3:$B$21=$N$3)*($C$3:$C$21=$O$3)),ROWS($A$1:$A1)))
 
Upvote 0
Maybe something like this


[Table="class: grid"][tr][td="bgcolor: #DCE6F1"][/td][td="bgcolor: #DCE6F1"]
M
[/td][td="bgcolor: #DCE6F1"]
N
[/td][td="bgcolor: #DCE6F1"]
O
[/td][td="bgcolor: #DCE6F1"]
P
[/td][td="bgcolor: #DCE6F1"]
Q
[/td][td="bgcolor: #DCE6F1"]
R
[/td][/tr]
[tr][td="bgcolor: #DCE6F1"]
1
[/td][td][/td][td][/td][td][/td][td][/td][td][/td][td][/td][/tr]

[tr][td="bgcolor: #DCE6F1"]
2
[/td][td][/td][td][/td][td][/td][td][/td][td][/td][td][/td][/tr]

[tr][td="bgcolor: #DCE6F1"]
3
[/td][td][/td][td]
3​
[/td][td]
4​
[/td][td]
_​
[/td][td][/td][td][/td][/tr]

[tr][td="bgcolor: #DCE6F1"]
4
[/td][td][/td][td][/td][td][/td][td][/td][td][/td][td]
Row​
[/td][/tr]

[tr][td="bgcolor: #DCE6F1"]
5
[/td][td]
1​
[/td][td]
3​
[/td][td]
4​
[/td][td]
7​
[/td][td][/td][td]
2​
[/td][/tr]

[tr][td="bgcolor: #DCE6F1"]
6
[/td][td]
2​
[/td][td]
3​
[/td][td]
4​
[/td][td]
0​
[/td][td][/td][td]
16​
[/td][/tr]

[tr][td="bgcolor: #DCE6F1"]
7
[/td][td]
3​
[/td][td]
3​
[/td][td]
4​
[/td][td]
1​
[/td][td][/td][td]
19​
[/td][/tr]

[tr][td="bgcolor: #DCE6F1"]
8
[/td][td]
4​
[/td][td][/td][td][/td][td][/td][td][/td][td][/td][/tr]

[tr][td="bgcolor: #DCE6F1"]
9
[/td][td]
5​
[/td][td][/td][td][/td][td][/td][td][/td][td][/td][/tr]

[tr][td="bgcolor: #DCE6F1"]
10
[/td][td]
6​
[/td][td][/td][td][/td][td][/td][td][/td][td][/td][/tr]
[/table]


Formula in R5 (helper column)
=IFERROR(AGGREGATE(15,6,(ROW(B$3:B$21)-ROW(B$3)+1)/((B$3:B$21=N$3)*(C$3:C$21=O$3)),M5),"")

Formula in N5 copied across and down
=IF(ISNUMBER($R5),INDEX(B$3:B$21,$R5),"")

M.
 
Upvote 0
Another version, here the output will be Column B + Column C:
{=IFERROR(INDEX(B$1:B$21+$C$1:$C$22,SMALL(IF(($B$1:$B$21=$N$3)*($C$1:$C$21=$O$3),ROW($B$1:$B$21)),ROWS(N$5:N5))),"")}
 
Upvote 0
How about
=INDEX($D$3:$D$21,AGGREGATE(15,6,(ROW($D$3:$D$21)-ROW($D$3)+1)/(($B$3:$B$21=$N$3)*($C$3:$C$21=$O$3)),ROWS($A$1:$A1)))


First off thanks for the help, however when I tested your formula it returned a values of 7 in N5, O5, and P5, when it should have returned the values of 3 4 7 in N5, O5 and P5.
 
Upvote 0
That formula is only to retrieve the values from col D.
I don't see the point of using a formula to return the values you are looking for.

However if that's what you want then in N5 put
=INDEX(B$3:B$21,AGGREGATE(15,6,(ROW($D$3:$D$21)-ROW($D$3)+1)/(($B$3:$B$21=$N$3)*($C$3:$C$21=$O$3)),ROWS($A$1:$A1)))
and copy across & down
 
Upvote 0
Hi, Try this:


Book1
MNOP
51347
62340
73341
84
95
106
Sheet6
Cell Formulas
RangeFormula
N5{=IFERROR(INDEX(B$1:B$21,SMALL(IF(($B$1:$B$21=$N$3)*($C$1:$C$21=$O$3),ROW($B$1:$B$21)),ROWS(N$5:N5))),"")}
O5{=IFERROR(INDEX(C$1:C$21,SMALL(IF(($B$1:$B$21=$N$3)*($C$1:$C$21=$O$3),ROW($B$1:$B$21)),ROWS(N$5:N5))),"")}
P5{=IFERROR(INDEX(D$1:D$21,SMALL(IF(($B$1:$B$21=$N$3)*($C$1:$C$21=$O$3),ROW($B$1:$B$21)),ROWS(N$5:N5))),"")}
Press CTRL+SHIFT+ENTER to enter array formulas.
 
Upvote 0
Maybe something like this


[TABLE="class: grid"]
<tbody>[TR]
[TD="bgcolor: #DCE6F1"][/TD]
[TD="bgcolor: #DCE6F1"]
M
[/TD]
[TD="bgcolor: #DCE6F1"]
N
[/TD]
[TD="bgcolor: #DCE6F1"]
O
[/TD]
[TD="bgcolor: #DCE6F1"]
P
[/TD]
[TD="bgcolor: #DCE6F1"]
Q
[/TD]
[TD="bgcolor: #DCE6F1"]
R
[/TD]
[/TR]
[TR]
[TD="bgcolor: #DCE6F1"]
1
[/TD]
[TD][/TD]
[TD][/TD]
[TD][/TD]
[TD][/TD]
[TD][/TD]
[TD][/TD]
[/TR]
[TR]
[TD="bgcolor: #DCE6F1"]
2
[/TD]
[TD][/TD]
[TD][/TD]
[TD][/TD]
[TD][/TD]
[TD][/TD]
[TD][/TD]
[/TR]
[TR]
[TD="bgcolor: #DCE6F1"]
3
[/TD]
[TD][/TD]
[TD]
3​
[/TD]
[TD]
4​
[/TD]
[TD]
_​
[/TD]
[TD][/TD]
[TD][/TD]
[/TR]
[TR]
[TD="bgcolor: #DCE6F1"]
4
[/TD]
[TD][/TD]
[TD][/TD]
[TD][/TD]
[TD][/TD]
[TD][/TD]
[TD]
Row​
[/TD]
[/TR]
[TR]
[TD="bgcolor: #DCE6F1"]
5
[/TD]
[TD]
1​
[/TD]
[TD]
3​
[/TD]
[TD]
4​
[/TD]
[TD]
7​
[/TD]
[TD][/TD]
[TD]
2​
[/TD]
[/TR]
[TR]
[TD="bgcolor: #DCE6F1"]
6
[/TD]
[TD]
2​
[/TD]
[TD]
3​
[/TD]
[TD]
4​
[/TD]
[TD]
0​
[/TD]
[TD][/TD]
[TD]
16​
[/TD]
[/TR]
[TR]
[TD="bgcolor: #DCE6F1"]
7
[/TD]
[TD]
3​
[/TD]
[TD]
3​
[/TD]
[TD]
4​
[/TD]
[TD]
1​
[/TD]
[TD][/TD]
[TD]
19​
[/TD]
[/TR]
[TR]
[TD="bgcolor: #DCE6F1"]
8
[/TD]
[TD]
4​
[/TD]
[TD][/TD]
[TD][/TD]
[TD][/TD]
[TD][/TD]
[TD][/TD]
[/TR]
[TR]
[TD="bgcolor: #DCE6F1"]
9
[/TD]
[TD]
5​
[/TD]
[TD][/TD]
[TD][/TD]
[TD][/TD]
[TD][/TD]
[TD][/TD]
[/TR]
[TR]
[TD="bgcolor: #DCE6F1"]
10
[/TD]
[TD]
6​
[/TD]
[TD][/TD]
[TD][/TD]
[TD][/TD]
[TD][/TD]
[TD][/TD]
[/TR]
</tbody>[/TABLE]


Formula in R5 (helper column)
=IFERROR(AGGREGATE(15,6,(ROW(B$3:B$21)-ROW(B$3)+1)/((B$3:B$21=N$3)*(C$3:C$21=O$3)),M5),"")

Formula in N5 copied across and down
=IF(ISNUMBER($R5),INDEX(B$3:B$21,$R5),"")

M.

Thanks so much Marcelo your formula worked.
 
Upvote 0
Hi, Try this:

MNOP

<colgroup><col style="width: 25pxpx"><col><col><col><col></colgroup><thead>
</thead><tbody>
[TD="align: center"]5[/TD]
[TD="align: right"]1[/TD]
[TD="align: right"]3[/TD]
[TD="align: right"]4[/TD]
[TD="align: right"]7[/TD]

[TD="align: center"]6[/TD]
[TD="align: right"]2[/TD]
[TD="align: right"]3[/TD]
[TD="align: right"]4[/TD]
[TD="align: right"]0[/TD]

[TD="align: center"]7[/TD]
[TD="align: right"]3[/TD]
[TD="align: right"]3[/TD]
[TD="align: right"]4[/TD]
[TD="align: right"]1[/TD]

[TD="align: center"]8[/TD]
[TD="align: right"]4[/TD]

[TD="align: center"]9[/TD]
[TD="align: right"]5[/TD]

[TD="align: center"]10[/TD]
[TD="align: right"]6[/TD]

</tbody>
Sheet6

[TABLE="width: 85%"]
<tbody>[TR]
[TD]Array Formulas[TABLE="width: 100%"]
<thead>[TR="bgcolor: [URL=https://www.mrexcel.com/forum/usertag.php?do=list&action=hash&hash=DAE7F5]#DAE7F5[/URL] "]
[TH="width: 10px"]Cell[/TH]
[TH="align: left"]Formula[/TH]
[/TR]
</thead><tbody>[TR]
[TH="width: 10px, bgcolor: [URL=https://www.mrexcel.com/forum/usertag.php?do=list&action=hash&hash=DAE7F5]#DAE7F5[/URL] "]N5[/TH]
[TD="align: left"]{=IFERROR(INDEX(B$1:B$21,SMALL(IF(($B$1:$B$21=$N$3)*($C$1:$C$21=$O$3),ROW($B$1:$B$21)),ROWS(N$5:N5))),"")}[/TD]
[/TR]
[TR]
[TH="width: 10px, bgcolor: [URL=https://www.mrexcel.com/forum/usertag.php?do=list&action=hash&hash=DAE7F5]#DAE7F5[/URL] "]O5[/TH]
[TD="align: left"]{=IFERROR(INDEX(C$1:C$21,SMALL(IF(($B$1:$B$21=$N$3)*($C$1:$C$21=$O$3),ROW($B$1:$B$21)),ROWS(N$5:N5))),"")}[/TD]
[/TR]
[TR]
[TH="width: 10px, bgcolor: [URL=https://www.mrexcel.com/forum/usertag.php?do=list&action=hash&hash=DAE7F5]#DAE7F5[/URL] "]P5[/TH]
[TD="align: left"]{=IFERROR(INDEX(D$1:D$21,SMALL(IF(($B$1:$B$21=$N$3)*($C$1:$C$21=$O$3),ROW($B$1:$B$21)),ROWS(N$5:N5))),"")}[/TD]
[/TR]
</tbody>[/TABLE]
Entered with Ctrl+Shift+Enter. If entered correctly, Excel will surround with curly braces {}.
Note: Do not try and enter the {} manually yourself[/TD]
[/TR]
</tbody>[/TABLE]

That worked perfectly, thanks so much.
 
Upvote 0
That formula is only to retrieve the values from col D.
I don't see the point of using a formula to return the values you are looking for.

However if that's what you want then in N5 put
=INDEX(B$3:B$21,AGGREGATE(15,6,(ROW($D$3:$D$21)-ROW($D$3)+1)/(($B$3:$B$21=$N$3)*($C$3:$C$21=$O$3)),ROWS($A$1:$A1)))
and copy across & down


That formula also worked thanks alot.
 
Upvote 0

Forum statistics

Threads
1,224,823
Messages
6,181,177
Members
453,021
Latest member
Justyna P

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