P
Peter
I have discovered a problem with IF statements that I need to create a way around. Here are two examples
1) Let's say I have 3 columns of numbers in A, B and C, and I want to add a column D as follows: in each row in column D, I want to take the sum of A and B data in that row, and divide by column C in that row for those instances where Col C data is non-zero. If C data is zero, I want a blank in column D so as not to mess up the averaging of COLUMN D when done. So I write
if(C1<>0,(A1+B1)/C1,"")
The problem is, if C1 is zero you still get #Div/0! as the result from Excel in cell D1
2) Similarly, I want to take the standard deviation of A, B, and C column data in column D, but in some rows there are instances where A,B and C are blanks. Let's say A2,B2 and C2 are blanks. If I write =isnumber(sum(A2..C2)) in D2, I get FALSE as expected, but if I write in D2 the following: =if(isnumber(sum(A2..C2)),stdev(A2..C2),""), I STILL get #Div/0! even though I am trying to test for this condition and avoid have this#Div/0! come in
It does not seem to matter that the "false" condition in the IF statement has been achieved. Excel seems to get stuck on the fact that I am potentially asking for a divide by zero, even though this is precisely what I am seeking to avoid
Certainly I could add an extra step in extra cells but it gets very cumbersome this way. Is there any direct "one-cell way" of getting around this
Thanks
1) Let's say I have 3 columns of numbers in A, B and C, and I want to add a column D as follows: in each row in column D, I want to take the sum of A and B data in that row, and divide by column C in that row for those instances where Col C data is non-zero. If C data is zero, I want a blank in column D so as not to mess up the averaging of COLUMN D when done. So I write
if(C1<>0,(A1+B1)/C1,"")
The problem is, if C1 is zero you still get #Div/0! as the result from Excel in cell D1
2) Similarly, I want to take the standard deviation of A, B, and C column data in column D, but in some rows there are instances where A,B and C are blanks. Let's say A2,B2 and C2 are blanks. If I write =isnumber(sum(A2..C2)) in D2, I get FALSE as expected, but if I write in D2 the following: =if(isnumber(sum(A2..C2)),stdev(A2..C2),""), I STILL get #Div/0! even though I am trying to test for this condition and avoid have this#Div/0! come in
It does not seem to matter that the "false" condition in the IF statement has been achieved. Excel seems to get stuck on the fact that I am potentially asking for a divide by zero, even though this is precisely what I am seeking to avoid
Certainly I could add an extra step in extra cells but it gets very cumbersome this way. Is there any direct "one-cell way" of getting around this
Thanks