I'm sure this is simple but....

FatalLordes

New Member
Joined
Dec 22, 2017
Messages
26
... I'm having a brain fart moment and for the life of me can't figure it out.

I have the following:

1693707562209.png

What I want to do is look at cell B23 and if it is LESS than B10 (and would be coloured red if it was), do nothing as I'm not interested in negative numbers. But if it MORE than B10 (and would be coloured black), I want to do B23 - B10 and assign the value to K23 with the formula K23 = K23 + whatever B23 - B10 is. Then I want to do the same for C and then D, etc, but all adding to K23. So essentially K23 will be the value to the other cells added together but only if row 23 is MORE than row 10 (but looking at individual cells). I hope I explained that correct. So for row 23, the value of K23 at the end would be $520.82.

If it helps, I did do conditional formatting which when the value is less than that in row 10 it is coloured red.

I'm just hitting brick walls when I try to do this so would truly appreciate some help :)
 

Excel Facts

Wildcard in VLOOKUP
Use =VLOOKUP("Apple*" to find apple, Apple, or applesauce
Try:
Book1
BCDEFGHIJK
10$50,000.00$50,000.00$100,000.00$100,000.00$100,000.00$25,000.00
11
22
23$49,362.81$50,146.17$100,336.5298,680.98$99,235.66$25,038.13520.82
24$49.378.63$50,166.27$100,379.92$98,715.11$99,295.84$25,049.42
25$49,279.43$50,045.78$100,110.40598,524.87$98,994.68$24,977.42
Sheet2
Cell Formulas
RangeFormula
K23K23=SUM(IF(B23:G23>$B$10:$G$10,B23:G23-$B$10:$G$10))
 
Upvote 0
=SUM(IF(B23:G23>$B$10:$G$10,B23:G23-$B$10:$G$10))
Thanks. Tried that but I get an error in K23 saying "A value used in the formula is of the wrong data type". I confirmed that all referenced cells are formatted as currency, including K23. What have I done wrong?

So this only adds the difference up when cell in row 23 is larger than cell in row 10 (same column)? I didn't realise it could be done on one line - I assumed VBA would be necessary.
 
Upvote 0
Check with the ISNUMBER function to make sure all cells are numeric.
Book1
BCDEFG
10$50,000.00$50,000.00$100,000.00$100,000.00$100,000.00$25,000.00
11TRUETRUETRUETRUETRUETRUE
22
23$49,362.81$50,146.17$100,336.5298,680.98$99,235.66$25,038.13
24TRUETRUETRUETRUETRUETRUE
Sheet2
Cell Formulas
RangeFormula
B11:G11,B24:G24B11=ISNUMBER(B10)
 
Upvote 0
What version of Excel are you using? It is quite possible that @AhoyNC's formula will only work if you have MS 365.

I suggest that you update your Account details (or click your user name at the top right of the forum) so helpers always know what Excel version(s) & platform(s) you are using as the best solution often varies by version. (Don’t forget to scroll down & ‘Save’)

This is Ahoy's formula converted to sumproduct, see if this works for you in K23.
Excel Formula:
=SUMPRODUCT(($B23:$G23>$B$10:$G$10) * ($B23:$G23-$B$10:$G$10))
 
Upvote 0
Ahh, I'm Office Pro Plus 2019....

And YES, your SUMPRODUCT works. Thank you BOTH. I honest thought it would be a big VBA script but this is so much more elegant and simple. I think I was overcomplicating this - I seriously need more coffee!!

Thank YOU so much! :)
 
Upvote 0

Forum statistics

Threads
1,215,071
Messages
6,122,964
Members
449,094
Latest member
Anshu121

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