MrExcel Publishing
Your One Stop for Excel Tips & Solutions

Determine if 2 cells contain data.


Posted by Robert Beckert on July 20, 2001 5:23 AM

I use the formula =IF(J1=0,"?","OK") in cell A1 to determine if data has been entered into cell J1. Now I need to know if data has been entered in cell H1 AND/OR cell J1. Can you help?


Posted by Aladin Akyurek on July 20, 2001 5:30 AM

=IF(AND(ISBLANK(J1),ISBLANK(H1)),"?","OK")

This formula expects that both cells, J1 and H1, are not empty.

Is this what you want?

If at least one entry is sufficient to issue "OK", you need this one:

=IF(OR(LEN(J1)>0,LEN(H1)>0),"OK","?")

Aladin

Posted by Robert Beckert on July 20, 2001 9:04 AM

I copied and pasted your suggested formulas and neither one would work. Data entered in either J1 or H1 cells produced no change in A1.

Posted by Aladin Akyurek on July 20, 2001 10:03 AM

Robert,

First delete the row where you did copying and pasting (which may have changed the formatting of the cell to text). Type one of those formulas yourself in A1 and see what happens.

Aladin

Posted by Robert Beckert on July 27, 2001 8:50 AM

I've determined why the formula you suggested wasn't working for me. I've got a formula in cell J1 calculating from information entered in other cells. I guess what I need is a formula that will recognize any input in H1 and a calculation in J1. Does that make sense?

Thanks for your help.

BoB

Posted by Aladin Akyurek on July 28, 2001 11:30 PM

Hi Robert,

It seems I missed your latest post. Whence this belated reaction.

Given (1) -- "OK" if both H1 and J1 must have data, otherwise "?".

=IF(AND(LEN(H1)>0,LEN(J1)>0),"OK","?")

Given (2) -- "OK" if either H1 or J1 has data, otherwise "?".

=IF(OR(LEN(H1)>0,LEN(J1)>0),"OK","?")

ISBLANK() [ instead of LEN()>0 ] indeed presupposes that the cell to be tested must not contain a formula.

Aladin

===============