## Need Help With Excel Formula; IF and NULL

From Visual Basic to GNU C, this is the place to talk programming.

Moderators: SecretSquirrel, just brew it!

### Need Help With Excel Formula; IF and NULL

So I'm trying to run a formula that checks to see if a cell has data or not (value or null), and if it's empty it leaves the totals cell empty as well (Null). But if it has a value, it then SUMs all the needed cells.

Now, I have a few products that are SUM'd anyway, those would be the green colored products. That's a simple SUM formula. But the red colored products only matter if there are actual on hand quantites [# of units]. I had written an IF formula but it keeps erroring and I'm not sure what to do to make it work.

Code: Select all
`B2=if(C2,null),,SUM(C2:E2)`

I've tried the following with no success.
Code: Select all
`=if(C2,null),null,SUM(C2:E2)=if(C2,null),#null,SUM(C2:E2)`

|FN|Steel wrote:Millions of sheep doesn't make [Censored] right.
Justice
Gerbil Elite

Posts: 989
Joined: Fri Apr 23, 2004 1:30 am
Location: Phoenix, AZ (AKA Hell)

### Re: Need Help With Excel Formula; IF and NULL

Figures... I post the question then figure it out.

I got it working with this:

Code: Select all
`=if(C2=0,"",SUM(C2:E2))`
|FN|Steel wrote:Millions of sheep doesn't make [Censored] right.
Justice
Gerbil Elite

Posts: 989
Joined: Fri Apr 23, 2004 1:30 am
Location: Phoenix, AZ (AKA Hell)

### Re: Need Help With Excel Formula; IF and NULL

=IF(ISNUMBER(C2),SUM(C2:E2),"")
JustAnEngineer
Gerbil God
Gold subscriber

Posts: 16352
Joined: Sat Jan 26, 2002 7:00 pm
Location: The Heart of Dixie