ExcelBanter

ExcelBanter (https://www.excelbanter.com/)
-   Excel Worksheet Functions (https://www.excelbanter.com/excel-worksheet-functions/)
-   -   If Statement / Array (https://www.excelbanter.com/excel-worksheet-functions/208111-if-statement-array.html)

Jeff

If Statement / Array
 
Hello,

I have data in columns A, B, and C. In column D, I would like a formula
that sums the contents of A1:C1, but only if none of the cells contains a
zero. In other words, if all the cells are greater than zero, return the
sum. If one of the cells has a figure of zero, return zero.

Help?! TIA

T. Valko

If Statement / Array
 
One way:

=(COUNTIF(A1:C1,0)=0)*SUM(A1:C1)

Empty cells are ignored.

--
Biff
Microsoft Excel MVP


"JEFF" wrote in message
...
Hello,

I have data in columns A, B, and C. In column D, I would like a formula
that sums the contents of A1:C1, but only if none of the cells contains a
zero. In other words, if all the cells are greater than zero, return the
sum. If one of the cells has a figure of zero, return zero.

Help?! TIA




Tom Hutchins

If Statement / Array
 
Try this in D1:

=IF(OR(A1=0,B1=0,C1=0),0,SUM(A1:C1))

Hope this helps,

Hutch

"JEFF" wrote:

Hello,

I have data in columns A, B, and C. In column D, I would like a formula
that sums the contents of A1:C1, but only if none of the cells contains a
zero. In other words, if all the cells are greater than zero, return the
sum. If one of the cells has a figure of zero, return zero.

Help?! TIA


Mike H

If Statement / Array
 
Try,

=SUM(IF(MIN(A1:C1)0,A1:C1))

Mike

"JEFF" wrote:

Hello,

I have data in columns A, B, and C. In column D, I would like a formula
that sums the contents of A1:C1, but only if none of the cells contains a
zero. In other words, if all the cells are greater than zero, return the
sum. If one of the cells has a figure of zero, return zero.

Help?! TIA


Jeff

If Statement / Array
 
It does, thanks.... Was wondering if I had 100 columns instead of three,
what my approach would be.....

Thanks again

"Tom Hutchins" wrote:

Try this in D1:

=IF(OR(A1=0,B1=0,C1=0),0,SUM(A1:C1))

Hope this helps,

Hutch

"JEFF" wrote:

Hello,

I have data in columns A, B, and C. In column D, I would like a formula
that sums the contents of A1:C1, but only if none of the cells contains a
zero. In other words, if all the cells are greater than zero, return the
sum. If one of the cells has a figure of zero, return zero.

Help?! TIA


Carrol

If Statement / Array
 
what if i have a formula, lets say 1+a , whereby i need to get the sum of
this "1+a" for a = 1 to 20??

T. Valko

If Statement / Array
 
Try this:

=SUMPRODUCT(1+ROW(INDIRECT("1:20")))

--
Biff
Microsoft Excel MVP


"carrol" wrote in message
...
what if i have a formula, lets say 1+a , whereby i need to get the sum of
this "1+a" for a = 1 to 20??





All times are GMT +1. The time now is 06:43 AM.

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