ExcelBanter

ExcelBanter (https://www.excelbanter.com/)
-   Excel Worksheet Functions (https://www.excelbanter.com/excel-worksheet-functions/)
-   -   SUM and IF results (https://www.excelbanter.com/excel-worksheet-functions/145978-sum-if-results.html)

David

SUM and IF results
 
I want to SUM a horizontal row of cells, of which one contains the IF function:
=IF(C2<2,"50",IF(C2=2,"25",IF(C23,"0")))

I want the results of the IF function, 50, 25, or 0, to be included in the
SUM.
Any tips?

Arvi Laanemets

SUM and IF results
 
Hi

Replace your formula with
=IF(C2<2,50,IF(C2=2,25,IF(C23,0)))

But what about 3=C22

Btw. you can do without any IF's (slightly different conditions in my
example here)

=50-(C2=2)-(C22)


--
Arvi Laanemets
( My real mail address: arvi.laanemets<attarkon.ee )


"David" wrote in message
...
I want to SUM a horizontal row of cells, of which one contains the IF
function:
=IF(C2<2,"50",IF(C2=2,"25",IF(C23,"0")))

I want the results of the IF function, 50, 25, or 0, to be included in the
SUM.
Any tips?




T. Valko

SUM and IF results
 
=IF(C2<2,"50",IF(C2=2,"25",IF(C23,"0")))

At the very least remove the quotes from around the numbers. Enclosing
numbers in quotes makes them TEXT and a SUM function ignores text.

=IF(C2<2,50,IF(C2=2,25,IF(C23,0)))

Now, about your logic in the formula...

If C2 = 3 the result will be FALSE. If C2 is empty the result will be 50.

So, I'd write the formula like this:

=IF(ISNUMBER(C2),IF(C2<2,50,IF(C2=2,25,0)),0)

Now you can include that cell in your SUM function.

Biff

"David" wrote in message
...
I want to SUM a horizontal row of cells, of which one contains the IF
function:
=IF(C2<2,"50",IF(C2=2,"25",IF(C23,"0")))

I want the results of the IF function, 50, 25, or 0, to be included in the
SUM.
Any tips?




T. Valko

SUM and IF results
 
=50-(C2=2)-(C22)

Think you're missing some stuff the

=50-(C2=2)*25-(C22)*50

And to account for an empty cell:

=(50-(C2=2)*25-(C22)*50)*(C2<"")

Biff

"Arvi Laanemets" wrote in message
...
Hi

Replace your formula with
=IF(C2<2,50,IF(C2=2,25,IF(C23,0)))

But what about 3=C22

Btw. you can do without any IF's (slightly different conditions in my
example here)

=50-(C2=2)-(C22)


--
Arvi Laanemets
( My real mail address: arvi.laanemets<attarkon.ee )


"David" wrote in message
...
I want to SUM a horizontal row of cells, of which one contains the IF
function:
=IF(C2<2,"50",IF(C2=2,"25",IF(C23,"0")))

I want the results of the IF function, 50, 25, or 0, to be included in
the
SUM.
Any tips?






David

SUM and IF results
 
Arvi!
Thanks, I love the simple solutions.
David

"Arvi Laanemets" wrote:

Hi

Replace your formula with
=IF(C2<2,50,IF(C2=2,25,IF(C23,0)))

But what about 3=C22

Btw. you can do without any IF's (slightly different conditions in my
example here)

=50-(C2=2)-(C22)


--
Arvi Laanemets
( My real mail address: arvi.laanemets<attarkon.ee )


"David" wrote in message
...
I want to SUM a horizontal row of cells, of which one contains the IF
function:
=IF(C2<2,"50",IF(C2=2,"25",IF(C23,"0")))

I want the results of the IF function, 50, 25, or 0, to be included in the
SUM.
Any tips?





David

SUM and IF results
 
T!
Thanks, I love the simple answers.
David

"T. Valko" wrote:

=IF(C2<2,"50",IF(C2=2,"25",IF(C23,"0")))


At the very least remove the quotes from around the numbers. Enclosing
numbers in quotes makes them TEXT and a SUM function ignores text.

=IF(C2<2,50,IF(C2=2,25,IF(C23,0)))

Now, about your logic in the formula...

If C2 = 3 the result will be FALSE. If C2 is empty the result will be 50.

So, I'd write the formula like this:

=IF(ISNUMBER(C2),IF(C2<2,50,IF(C2=2,25,0)),0)

Now you can include that cell in your SUM function.

Biff

"David" wrote in message
...
I want to SUM a horizontal row of cells, of which one contains the IF
function:
=IF(C2<2,"50",IF(C2=2,"25",IF(C23,"0")))

I want the results of the IF function, 50, 25, or 0, to be included in the
SUM.
Any tips?






All times are GMT +1. The time now is 04:11 AM.

Powered by vBulletin® Copyright ©2000 - 2025, Jelsoft Enterprises Ltd.
ExcelBanter.com