IF Function to vlookup a value to give % margin

Gtasios4

Board Regular
Joined
Apr 21, 2022
Messages
80
Office Version
  1. 2021
Platform
  1. Windows
Hi All,

I need a formula to run in cell S4 and get the margin % 1-(buying cost/N4) ... Something like =IFERROR(IF(1-(VLOOKUP;A4;PRODUCT_INFO!$C$S;17;0)/N4);'')

But in my product info I also have another column (col. number 16) with a promo buying cost... so I need to run a logical test; if it finds a value in "promo buying cost" column in Product Info sheet, then run that division, if it doesn't find any value then take the "normal buying cost" (col. number 17) in Product Info sheet and then run the division.

1651830229358.png
 

Excel Facts

How to create a cell-sized chart?
Tiny charts, called Sparklines, were added to Excel 2010. Look for Sparklines on the Insert tab.
Something like
=IFERROR(IF(VLOOKUP(A2,E2:H6,17,FALSE)=0,1-(VLOOKUP(A2,E2:H6,16,FALSE))/N4,1-(VLOOKUP(A2,E2:H6,17,FALSE))/n4),"")

add your vlookup formulas - as the one you posted did not seem correct

=IFERROR(IF(VLOOKUP(A9,E2:U6,17,FALSE)=0,1-(VLOOKUP(32,E2:U6,16,FALSE))/N4,1-(VLOOKUP(A9,E2:U6,17,FALSE))/N4),"")

Note the range must cover the 16/17 columns

I have added a very simple sheet example
Book1
ABCDEFGH
1
2BF2AF1H1
3BF2H2
4CF3H3
Sheet1
Cell Formulas
RangeFormula
B2B2=IFERROR(IF(VLOOKUP(A2,E2:H6,3,FALSE)=0,VLOOKUP(A2,E2:H6,2,FALSE),VLOOKUP(A2,E2:H6,3,FALSE)),0)
 
Upvote 0
Something like
=IFERROR(IF(VLOOKUP(A2,E2:H6,17,FALSE)=0,1-(VLOOKUP(A2,E2:H6,16,FALSE))/N4,1-(VLOOKUP(A2,E2:H6,17,FALSE))/n4),"")

add your vlookup formulas - as the one you posted did not seem correct

=IFERROR(IF(VLOOKUP(A9,E2:U6,17,FALSE)=0,1-(VLOOKUP(32,E2:U6,16,FALSE))/N4,1-(VLOOKUP(A9,E2:U6,17,FALSE))/N4),"")

Note the range must cover the 16/17 columns

I have added a very simple sheet example
Book1
ABCDEFGH
1
2BF2AF1H1
3BF2H2
4CF3H3
Sheet1
Cell Formulas
RangeFormula
B2B2=IFERROR(IF(VLOOKUP(A2,E2:H6,3,FALSE)=0,VLOOKUP(A2,E2:H6,2,FALSE),VLOOKUP(A2,E2:H6,3,FALSE)),0)
Works perfect!!! Thank you so much for your valuable help!
 
Upvote 0

Forum statistics

Threads
1,223,989
Messages
6,175,812
Members
452,671
Latest member
jowalker82

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