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

Postposted on Fri Aug 06, 2010 1:40 pm

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.

Image

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)


Thank you for any help you can provide.
|FN|Steel wrote:Millions of sheep doesn't make [Censored] right.
Justice
Gerbil Elite
 
Posts: 989
Joined: Fri Apr 23, 2004 12:30 am
Location: Phoenix, AZ (AKA Hell)

Re: Need Help With Excel Formula; IF and NULL

Postposted on Fri Aug 06, 2010 1:47 pm

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 12:30 am
Location: Phoenix, AZ (AKA Hell)

Re: Need Help With Excel Formula; IF and NULL

Postposted on Fri Aug 06, 2010 5:35 pm

How about this?

=IF(ISNUMBER(C2),SUM(C2:E2),"")
JustAnEngineer
Gerbil God
Gold subscriber
 
 
Posts: 15140
Joined: Sat Jan 26, 2002 6:00 pm
Location: The Heart of Dixie


Return to Developer's Den

Who is online

Users browsing this forum: No registered users and 1 guest