# IF statement issues

#### Ozzie2842

##### New Member
I'm using the following formula to calculate prices for products. It works well if Cell C2 is blank. However, I want to look up a different price (column 3 in the vlookup) if we type anything in Cell C2.

=IF(D2="","",IF(C2="",VLOOKUP(D2,\$I\$2:INDEX(\$I\$2:\$K\$20,COUNTA(\$I\$2:\$I\$20),2),2,0)))

I'm not getting where to include this additional formula to get this to work=VLOOKUP(D2,\$I\$2:INDEX(\$I\$2:\$K\$20,COUNTA(\$I\$2:\$I\$20),3),3,0)))

If this is too confusing, I'll upload the spreadsheet. Thanks in advance for having a look.

Oz

### Excel Facts

Excel motto
Not everything I do at work revolves around Excel. Only the fun parts.
I'm using the following formula to calculate prices for products. It works well if Cell C2 is blank. However, I want to look up a different price (column 3 in the vlookup) if we type anything in Cell C2.

=IF(D2="","",IF(C2="",VLOOKUP(D2,\$I\$2:INDEX(\$I\$2:\$K\$20,COUNTA(\$I\$2:\$I\$20),2),2,0)))

I'm not getting where to include this additional formula to get this to work=VLOOKUP(D2,\$I\$2:INDEX(\$I\$2:\$K\$20,COUNTA(\$I\$2:\$I\$20),3),3,0)))

If this is too confusing, I'll upload the spreadsheet. Thanks in advance for having a look.

Oz
Try this...

=IF(D2="","",VLOOKUP(D2,\$I\$2:INDEX(\$K\$2:\$K\$20,COUNTA(\$I\$2:\$I\$20)),2+(C2<>""),0))

You're the best, thank you.

You're the best, thank you.
You're welcome. Thanks for the feedback!

Replies
5
Views
166
Replies
6
Views
177
Replies
7
Views
284
Replies
3
Views
163
Replies
1
Views
179

1,203,398
Messages
6,055,168
Members
444,767
Latest member
bryandaniel5

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

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