ExcelBanter

ExcelBanter (https://www.excelbanter.com/)
-   Excel Worksheet Functions (https://www.excelbanter.com/excel-worksheet-functions/)
-   -   Checking cells for 2 conditions (https://www.excelbanter.com/excel-worksheet-functions/151131-checking-cells-2-conditions.html)

Mary Lancaster

Checking cells for 2 conditions
 
Hi,
I hope someone can help me with this. I have four cells A1:A4. If all four
cells contain data or are blank then thats okay. But if 1, 2 or 3 cells
contain data then I want a warning that all cells must be blank or contain
data.

Thanks
Mary



Pete_UK

Checking cells for 2 conditions
 
Try this:

=IF(AND(COUNTA(A1:A4)0,COUNTA(A1:A4)<4),"Incorrec t entries","")

Change the wording of "Incorrect entries" to whatever message you
would like.

Hope this helps.

Pete

On Jul 21, 2:07 am, "Mary Lancaster" wrote:
Hi,
I hope someone can help me with this. I have four cells A1:A4. If all four
cells contain data or are blank then thats okay. But if 1, 2 or 3 cells
contain data then I want a warning that all cells must be blank or contain
data.

Thanks
Mary




T. Valko

Checking cells for 2 conditions
 
One way.

You can use a formula like this in, say, B4:

=IF(OR(COUNTA(A1:A4)=4,COUNTBLANK(A1:A4)=4),"","Al l 4 cells must be either
filled or left empty")

Maybe give it a bold red font.

--
Biff
Microsoft Excel MVP


"Mary Lancaster" wrote in message
...
Hi,
I hope someone can help me with this. I have four cells A1:A4. If all four
cells contain data or are blank then thats okay. But if 1, 2 or 3 cells
contain data then I want a warning that all cells must be blank or contain
data.

Thanks
Mary




Harlan Grove[_2_]

Checking cells for 2 conditions
 
"Mary Lancaster" wrote...
I hope someone can help me with this. I have four cells A1:A4. If all four
cells contain data or are blank then thats okay. But if 1, 2 or 3 cells
contain data then I want a warning that all cells must be blank or contain
data.


More alternatives,

=IF(ABS(COUNTA(A1:A4)-2)<2,"A1:A4 partially filled","")

=IF(AND(COUNTIF(A1:A4,{"=";"<"})<4),"A1:A4 partially filled","")




All times are GMT +1. The time now is 02:35 AM.

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