Summing a row of cells that have derived their individual values from if Statements

G

Guest

Hi can anyone help...

I am trying to validate a form so that the Data cannot be saved if all the fields have not been filled in on the form and will return an error message
How I have done this is to use If statement on each individual cell so that it returns a value of 0 or 1 dependant on whether the field is empty or not. (This works fine
Then what I want to do is sum the value of these cells with an If statement to return a value of 0 or 1 which can then be used with the validation macros I have set up to either save the data or not dependant on the conditions...
So I tried =IF(SUM(A1:p1)=0,"1","0"
This didn't work and I thought it may have something to do with the SUM formul
So I tried =SUM(A1:p1
now the range of A1:p1 have their values assigned by the following IF Statement...

A1=IF(B32=0,"1","0"

Where B32 is one of the fields that must be filled in and so on and so forth and this works...

But when I try to sum the Range of A1:p1 it always gives me a value of 0............

Can anyone hel
 
J

JE McGimpsey

SUM will ignore text, which is what "1" is. Remove the quotation marks
from your formulae:

=IF(B32=0,1,0)

or, perhaps more simply:

=--(B32=0)

the first - coerces the TRUE/FALSE result of the comparision to -1/0,
respectively. The second - converts it to 1/0.
 
G

Guest

Thank you, I knew I had to be doing something stupid

I can't just use the second statement as it needs to validate the return value of the cell, but that will work fine thanks again... when I stop laughing at myself I'll sort it out.....
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top