# IF/THEN Excel Question: IF A1=any text THEN D1=1, if blank nothing

June 2, 2015 7:17 AM Subscribe

I am trying to create a list that then calculates the quantity of people on the list. I want a formula that will check A1 and B1 and see if they are blank, if so, I want nothing, if they have anything in them, I want them to be added together. I don't know exactly how to do this formula.

I'm somewhat new to Excel formatting.

I am trying to create a list that then calculates the quantity of people on the list. I want a formula that will check A1 and B1 and see if they are blank, if so, I want nothing, if they have anything in them, I want them to be added together. I don't know exactly how to do this formula.

I am fine with creating three columns, one for each A1 and B1 then a third to add them together, but I can't figure out how to write the formula to just check for any text, not specific text.

Thank you.

I'm somewhat new to Excel formatting.

I am trying to create a list that then calculates the quantity of people on the list. I want a formula that will check A1 and B1 and see if they are blank, if so, I want nothing, if they have anything in them, I want them to be added together. I don't know exactly how to do this formula.

I am fine with creating three columns, one for each A1 and B1 then a third to add them together, but I can't figure out how to write the formula to just check for any text, not specific text.

Thank you.

isblank()?

But there are much easier ways to count entries in a list. How is your list formatted?

posted by supercres at 7:23 AM on June 2, 2015

But there are much easier ways to count entries in a list. How is your list formatted?

posted by supercres at 7:23 AM on June 2, 2015

something like

=IF(ISBLANK(A1),0,A1) + IF(ISBLANK(B1),0,B1)

will work.

posted by jeather at 7:24 AM on June 2, 2015

=IF(ISBLANK(A1),0,A1) + IF(ISBLANK(B1),0,B1)

will work.

posted by jeather at 7:24 AM on June 2, 2015

Best answer:

If you add two cells together and one is blank, you should just get the value of the non blank cell, assuming they are both numbers.

COUNTA is another function to look at. It will give you the count of nonblank cells in a range. COUNTBLANK does the opposite.

posted by soelo at 7:28 AM on June 2, 2015 [1 favorite]

*if they have anything in them, I want them to be added together*If you add two cells together and one is blank, you should just get the value of the non blank cell, assuming they are both numbers.

COUNTA is another function to look at. It will give you the count of nonblank cells in a range. COUNTBLANK does the opposite.

posted by soelo at 7:28 AM on June 2, 2015 [1 favorite]

Do you want to add the contents of the cells together, or just get a count of how many cells have any content? If the first, sumif() could work; if the latter, you probably want counta() or countif().

posted by MadamM at 8:09 AM on June 2, 2015

posted by MadamM at 8:09 AM on June 2, 2015

Adding onto Soelo's comment. A blank cell counts as zero, so you don't have to use an if - then statement, and can just add them together. But if you were to multiply them, then you would get zero.

posted by cacao at 11:59 AM on June 2, 2015

posted by cacao at 11:59 AM on June 2, 2015

Response by poster: Thank you all. I figured it out. The COUNTA function worked perfectly.

posted by MnMrMstrd7 at 7:11 AM on June 3, 2015

posted by MnMrMstrd7 at 7:11 AM on June 3, 2015

« Older Right-brained hobbies for chronic fatigue? | Looking for comics like the show Misfits Newer »

This thread is closed to new comments.

=IF(ISBLANK(A1),"",A1+B1)

Or maybe

=IF(AND(ISBLANK(A1),ISBLANK(B1)),"",A1+B1)

or

=IF(OR(ISBLANK(A1),ISBLANK(B1)),"",A1+B1)

posted by Perplexity at 7:22 AM on June 2, 2015