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.



ABCDEFGHIJKLMNOP
312434_
4347
56571347
62732340
71183341
80024
97035
105556
11259
12430
13772
14424
15222
16103
17713
18340
19724
20783
21341

<tbody>
</tbody>
 
Last edited:

Excel Facts

Whats the difference between CONCAT and CONCATENATE?
The newer CONCAT function can reference a range of cells. =CONCATENATE(A1,A2,A3,A4,A5) becomes =CONCAT(A1:A5)
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


M
N
O
P
Q
R
1
2
3
3​
4​
_​
4
Row​
5
1​
3​
4​
7​
2​
6
2​
3​
4​
0​
16​
7
3​
3​
4​
1​
19​
8
4​
9
5​
10
6​

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


M
N
O
P
Q
R
1
2
3
3​
4​
_​
4
Row​
5
1​
3​
4​
7​
2​
6
2​
3​
4​
0​
16​
7
3​
3​
4​
1​
19​
8
4​
9
5​
10
6​

<tbody>
</tbody>


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
51347
62340
73341
84
95
106

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

Array Formulas
CellFormula
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))),"")}

<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>

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,214,832
Messages
6,121,845
Members
449,051
Latest member
excelquestion515

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