Formula anomaly

normpam

Active Member
Joined
Oct 30, 2002
Messages
355
I think I'm going to lose my mind.... still working on what seems to be a simple issue.

C3 = 10
D3 = 15
E3 = -30
F3 = 15
G3 = -10

The formula =Sum(C3:G3) results in zero
The formula =SUM(ABS(C3:G3)) results in 80

I would expect the result of the following formula to be "GOOD" - but it results in "BAD" and I cannot figure out why.

=IF(AND(SUM(C3:G3)=0,SUM(ABS(C3:G3)<>0)),"GOOD","BAD")

Both conditions are true - the sum of C3:G3 is zero, and the sum of the absolute values of those cells does NOT equal zero.

Help please!
 

Excel Facts

Format cells as currency
Select range and press Ctrl+Shift+4 to format cells as currency. (Shift 4 is the $ sign).
You have a parenthesis out of place.
Try:
IF(AND(SUM(C3:G3)=0,SUM(ABS(C3:G3))<>0),"GOOD","BAD")
 
Upvote 0
And if you use SUMPRODUCT, you can normally-enter the formula (just press Enter as usual) instead of array-entering it.

=IF(AND(SUM(C3:G3)=0, SUMPRODUCT(ABS(C3:G3))<>0), "good", "bad")
 
Upvote 0
You have a parenthesis out of place.
Try:
IF(AND(SUM(C3:G3)=0,SUM(ABS(C3:G3))<>0),"GOOD","BAD")
OMG... I feel like the scarecrow from Wizard of Oz... 'if I only had a brain'!
Thanks! While trying to get a solution I came up with another anomaly. When I put the following formula in a cell using VBA it keeps putting in an @ sign all by itself before the C8 in the formula. Very weird. What is more weird is that it is a phantom character. When I do a 'Find' in the Excel sheet it says there is no such character.

Range("B8").Value = "=SUM(abs(c8:bz8))"
 
Upvote 0
It needs to be
VBA Code:
Range("B8").Formula2 = "=SUM(abs(c8:bz8))"
Also please update your account details to show which version of Excel you are using, as this helps us to help you.
 
Upvote 0
It needs to be
VBA Code:
Range("B8").Formula2 = "=SUM(abs(c8:bz8))"
Also please update your account details to show which version of Excel you are using, as this helps us to help you.
Not sure if 'WOW' fully expresses it..... OK.... I just read a bit on Google about 'Formula2', but not clear to me what it does. Is there a simple explanation you could share?
Thanks!!
 
Upvote 0
It was added to VBA to allow for Dynmaic aware excel, so that you don't get the @ sign appearing in formulae.

Please don't forget to update your account details to show your version of Excel & then scroll down & click save. ;)
 
Upvote 0

Forum statistics

Threads
1,214,805
Messages
6,121,664
Members
449,045
Latest member
Marcus05

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