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