Small Lookup with 2 range criteria

cgsierra

Board Regular
Joined
Mar 21, 2011
Messages
142
Office Version
  1. 365
Hello,
I'm trying to put together a formula that will look at 2 columns and based on criteria for those columns to return the corresponding value of a 3rd column.
IE. I want to retrieve the smallest revenue of only subtotal clients with an Operating Income of 0.
Column A: Client, Column B: Revenue, Column C: Operating Income
A1: XXXX B1: 50 C1: 20
A2: Subtotal B2: 200 C2: 0
A3: YYYY B3: 55 C3: 24
A4: ZZZZ B4: 480 C4: 0
A5: Subtotal B5: 30 C5: 0
A6: Subtotal B6: 95 C6: 40

In this case, the answer would be 30.
I am using the following formula but it does not work well.
={SMALL(IF(AND(A:A="Sub-total",C:C=0), B:B, 9E+99), 1)}
thank you!
 

Excel Facts

Which lookup functions find a value equal or greater than the lookup value?
MATCH uses -1 to find larger value (lookup table must be sorted ZA). XLOOKUP uses 1 to find values greater and does not need to be sorted.
Hello,
I'm trying to put together a formula that will look at 2 columns and based on criteria for those columns to return the corresponding value of a 3rd column.
IE. I want to retrieve the smallest revenue of only subtotal clients with an Operating Income of 0.
Column A: Client, Column B: Revenue, Column C: Operating Income
A1: XXXX B1: 50 C1: 20
A2: Subtotal B2: 200 C2: 0
A3: YYYY B3: 55 C3: 24
A4: ZZZZ B4: 480 C4: 0
A5: Subtotal B5: 30 C5: 0
A6: Subtotal B6: 95 C6: 40

In this case, the answer would be 30.
I am using the following formula but it does not work well.
={SMALL(IF(AND(A:A="Sub-total",C:C=0), B:B, 9E+99), 1)}
thank you!
Don't use entire columns for this unless you have data in every row!

Array entered**:

=MIN(IF(A1:A6="Sub-total",IF(C1:C6=0,B1:B6)))

** array formulas need to be entered using the key combination of CTRL,SHIFT,ENTER (not just ENTER). Hold down both the CTRL key and the SHIFT key then hit ENTER.

I'm assuming column C will not have any empty cells within the data range.
 
Upvote 0
Thank you,
I was actually hoping to be able to use the SMALL function as I will also need to retrieve the second smallest, 3rd smallest and so on. Also, I do have spaces in the data ranges.
thanks!
 
Upvote 0
Thank you,
I was actually hoping to be able to use the SMALL function as I will also need to retrieve the second smallest, 3rd smallest and so on. Also, I do have spaces in the data ranges.
thanks!
By the way, both your formulas worked great, I just tweaked it a little to use the SMALL function! Thanks again!!
 
Upvote 0
Thank you,
I was actually hoping to be able to use the SMALL function as I will also need to retrieve the second smallest, 3rd smallest and so on. Also, I do have spaces in the data ranges.
thanks!
If column C contains empty cells they will evaluate as being equal to 0.

So, you might have to add an additional test to account for that.

Still array entered**:

=SMALL(IF(A1:A6="Sub-total",IF(C1:C6<>"",IF(C1:C6=0,B1:B6))),n)

Where n = the nth smallest

** array formulas need to be entered using the key combination of CTRL,SHIFT,ENTER (not just ENTER). Hold down both the CTRL key and the SHIFT key then hit ENTER.
 
Upvote 0

Forum statistics

Threads
1,224,552
Messages
6,179,486
Members
452,917
Latest member
MrsMSalt

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