Double formula for the same cell

seriousdamage

Board Regular
Joined
Aug 14, 2005
Messages
58
Hi, I have a vlookup formula in one cell :
=(VLOOKUP(D7,'Foods Database'!A:D,4,0)*E7)

The formula looks into one sheet to match a food name,
and reports the amount of protein the food has
everything is then multiplied by the cell containing the quantity. (E7)

Sometimes the lookup reports "#N/A"

I would like to add to the above formula that if the result of the lookup is "#N/A" than
in the cell replace #N/A with "0" (zero)

Can I add a second formula in the same cell?

Many Thanks
 

Excel Facts

Best way to learn Power Query?
Read M is for (Data) Monkey book by Ken Puls and Miguel Escobar. It is the complete guide to Power Query.
Code:
=IF(ISNA(VLOOKUP(D7,'Foods Database'!A:D,4,0)),0,VLOOKUP(D7,'Foods Database'!A:D,4,0)*E7)
 
Upvote 0
In Excel 2007 and 2010 you can use:
=IFERROR(VLOOKUP(D7,'Foods Database'!A:D,4,0)*E7,0)
That will replace any error with 0.
 
Upvote 0
Hi, I have a vlookup formula in one cell :
=(VLOOKUP(D7,'Foods Database'!A:D,4,0)*E7)

The formula looks into one sheet to match a food name,
and reports the amount of protein the food has
everything is then multiplied by the cell containing the quantity. (E7)

Sometimes the lookup reports "#N/A"

I would like to add to the above formula that if the result of the lookup is "#N/A" than
in the cell replace #N/A with "0" (zero)

Can I add a second formula in the same cell?

Many Thanks
One way...

Assuming that the food name will not appear more than once (if at all) in your data table.

=SUMIF('Foods Database'!A:A,D7,'Foods Database'!D:D)*E7
 
Upvote 0

Forum statistics

Threads
1,224,598
Messages
6,179,814
Members
452,945
Latest member
Bib195

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