Data Validation with Two Cells Referenced

sjcocks

New Member
Joined
Jun 4, 2014
Messages
4
Hi guys,

Hopefully quite a quick question here. I'm trying to add data validation to a cell, based on two criteria:
1) The value entered in the cell must be a number
2) The cell one to the left of it must be blank

In the custom formula input of the Data Validation box for cell B1, I have:

=AND(ISNUMBER(B1),A1="")

This works fine to detect whether A1 is blank (Rule 2), but allows any value to be input in cell B1 (defying Rule 1) when cell A1 is blank. I presume it has something to do with checking the status of two cells; as if I change the formula to say:

=AND(ISNUMBER(B1),1=1)

It is able to detect whether the value put in B1 is a number (Rule 1), but obviously it no longer checks whether A1 is blank (Rule 2).

I can't see anything online outlining limitations of data validation that would explain this behaviour so it would be great if someone could help me work out what's going on here and get something working!

Thanks a lot.
 

Excel Facts

How to find 2nd largest value in a column?
MAX finds the largest value. =LARGE(A:A,2) will find the second largest. =SMALL(A:A,3) will find the third smallest
Perhaps an alternative method might work for you.

Put a custom data validation in for cell B1: =A1="" and then in cell C1 enter a formula of =B1*1. No entry will be allowed in B1 if A1 is not blank and the result in cell C1 will alert you with an error message if text is entered in B1. What do you think?
 
Upvote 0
Hi Roger,

Thanks a lot for your response. Since posting, I managed to get it working as desired if I put the formula:

=AND(ISNUMBER(B1),A1="")

in cell C1 and then put "=C1" in the data validation formula for cell B1. I am quite confused as to why this works but the other doesn't.

It would be much better for this project if I can get the data validation working without having to use up an extra column, so it would be great if anyone would be able to suggest a way of doing this, or at least explain why the method I am trying isn't working.

Thanks
 
Upvote 0

Forum statistics

Threads
1,223,214
Messages
6,170,772
Members
452,353
Latest member
strainu

We've detected that you are using an adblocker.

We have a great community of people providing Excel help here, but the hosting costs are enormous. You can help keep this site running by allowing ads on MrExcel.com.
Allow Ads at MrExcel

Which adblocker are you using?

Disable AdBlock

Follow these easy steps to disable AdBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the icon in the browser’s toolbar.
2)Click on the "Pause on this site" option.
Go back

Disable AdBlock Plus

Follow these easy steps to disable AdBlock Plus

1)Click on the icon in the browser’s toolbar.
2)Click on the toggle to disable it for "mrexcel.com".
Go back

Disable uBlock Origin

Follow these easy steps to disable uBlock Origin

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back

Disable uBlock

Follow these easy steps to disable uBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back
Back
Top