Is it possible to IF, VLOOKUP else SUM?

Jeevz_87

New Member
Joined
Sep 21, 2021
Messages
37
Office Version
  1. 365
Platform
  1. Windows
Hi All,


I'm trying to overwrite an existing calculation if the data from another sheet is available, else carry out the existing calculation. The problem is I cant seem to get the formulae logic right.

What I would like is the following;

1) IF cell J10 in Sheet A = "Yes" AND date in BR7 = $G$4, then VLOOKUP using the project name in Sheet A in G10 against the projects in Sheet B and return the corresponding value from the Margin column.

2) IF cell J10 in Sheet A = "No" AND date in BR7 = $G$4, then SUM the exist calculation instead.

I've managed to do the first part correctly using dynamic headings which looks like this;

Excel Formula:
=IF(AND(J10= "Yes",BR$7=$G$4),XLOOKUP(G10,Feeder!D8:D2000,Feeder!BV8:BV2000))

But, I cant seem to do point 2).

How do I incorporate this into the above formulae???

Thank you in advance!


Jeevz
 
Good question, it should then just execute (($EM10+SUM($AC10:AD10))/$X10)*$Z10-($EV10+SUM($CZ10:CZ10)) which is a bespoke formulae that the client wanted. If the value in BP is greater then 0 then return the value in BP.

I hope that makes sense 😅
 
Upvote 0

Excel Facts

Copy formula down without changing references
If you have =SUM(F2:F49) in F50; type Alt+' in F51 to copy =SUM(F2:F49) to F51, leaving the formula in edit mode. Change SUM to COUNT.
In that case just add that formula to the False part of your previous formula.
 
Upvote 0
Apologies for sounding abit dense (I think ive been staring at this too long), how would that amended formula look?
 
Upvote 0
Try
Excel Formula:
=IF($BP10>0,BP10,IFERROR((($EM10+SUM($AC10:AD10))/$X10)*$Z10-($EV10+SUM($CZ10:CZ10)),BP10))
 
Upvote 0
Hi Fluff,

Sorry about the wait. So, if BP10 is not greater than 0 then the formula should execute the long sum formula to the right. I've actually managed to fix the issue by using the following;

Excel Formula:
 =IF($BP10>0,$BP10,IF($BP10="",SUM($EM10+SUM($AC10:AD10)/$X10)*$Z10-($EV10+SUM($CZ10:CZ10)),0))

Thanks again for your help with this Fluff, wouldn't have been able to progress this without your help(y)

Jeevz
 
Upvote 0
Glad you sorted it & thanks for letting us know.
 
Upvote 0

Forum statistics

Threads
1,214,864
Messages
6,121,986
Members
449,060
Latest member
mtsheetz

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