Nested If statement

francesshakira

New Member
Joined
Sep 22, 2011
Messages
11
I need to write a formula to help me return a value based on the following:


Price 2 Price 5 Price 3 Price 1 Price 4
Product A N/A 158 - 168 158



If Price 1 has a value greater than zero, then return that value, otherwise, select price 2...if not, then price 3...if not, then price 4...finally price 5.

I tried a nested if statement, but it's not working.

Help!
 

Excel Facts

Test for Multiple Conditions in IF?
Use AND(test, test, test, test) or OR(test, test, test, ...) as the logical_test argument of IF.
Welcome to the board. Something like this?

Excel Workbook
ABCDEF
1Price 2Price 5Price 3Price 1Price 4
215015800158150
Sheet1
 
Upvote 0
when you say "if not," do you mean > 0? if so, then:

=if(price1>0,price1,if(price2>0,price2,if(price3>0,price3,if(price4>0,price4,price5))))
 
Upvote 0
This is the formula that I had originally written, but it doesn't work if there are is an N/A for one of the prices.

I have 5 different sources for prices that I did Vlookups for. That is why I have some N/A values.
 
Upvote 0
2nd attempt, to deal with N/A...

Excel Workbook
ABCDEF
1Price 2Price 5Price 3Price 1Price 4
2N/A15800158158
Sheet1
 
Upvote 0
I need to write a formula to help me return a value based on the following:


Price 2 Price 5 Price 3 Price 1 Price 4
Product A N/A 158 - 168 158



If Price 1 has a value greater than zero, then return that value, otherwise, select price 2...if not, then price 3...if not, then price 4...finally price 5.

I tried a nested if statement, but it's not working.

Help!
If you can sort the prices like below:

Book1
ABCDEF
1_Price 1Price 2Price 3Price 4Price 5
2Product A168N/A-158158
Sheet1

This array formula**:

=INDEX(B2:F2,MATCH(TRUE,ISNUMBER(B2:F2),0))

** 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
njimack and T. Valko are probably on to more sound suggestions than mine, but adding n() around all of the cell references will treat N/A (or any other non-number) as 0:

=IF(N(A1)>0,A1,IF(N(A2)>0,A2,IF(N(A3)>0,A3,IF(N(A4)>0,A4,A5))))
 
Upvote 0

Forum statistics

Threads
1,224,559
Messages
6,179,517
Members
452,921
Latest member
BBQKING

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