Data Validation?

Carly

Active Member
Joined
Aug 21, 2002
Messages
370
I have 4 cells (A1, A2, A3 & A4) and each cell can only have the values 1, 2, 3 or 4 in them. I know I can do this with Data Validation, but I would like to be able to restrict the user from entering the same number in 2 cells.

The user would be expected to enter one of the values 1 to 4 into the 4 cells, but not the same number in more than one cell.

For Example

1:2:3:4
4:3:2:1
1:4:3:2

Not

1:1:3:4

Hope this makes sense.

Is there any way this can be done?
 

Excel Facts

Format cells as date
Select range and press Ctrl+Shift+3 to format cells as date. (Shift 3 is the # sign which sort of looks like a small calendar).
Highlight your input cells, select Data Validation from the Excel menu, select Allow: Custom and then enter this formula:

=AND($A1<5,COUNTIF($A:$A,$A1)=1)


* just realized you want validation in same row, not down a column; will try to rework formula when I get a minute
 
Last edited:
Upvote 0
Thanks for replying, I changed it slightly to this

=AND(A1<5,COUNTIF($A1:$D1,A1)=1)

Is there anyway you can have 2 lots of data validation (i.e. A list of 1 to 4 & then this forumla?)
 
Upvote 0
Is there anyway you can have 2 lots of data validation (i.e. A list of 1 to 4 & then this forumla?)

Not sure I understand what you mean. Doesn't the "A1<5" essentially give you a list of 1 to 4? [I guess technically you could enter 0 or negative numbers, but you could stop that by adding "A1>0"]
 
Upvote 0
It does stop you from entering anything other than 1 to 4 but doesn't drop down a list.
Was just trying to save and explanation to the end user.
 
Upvote 0

Forum statistics

Threads
1,224,586
Messages
6,179,726
Members
452,939
Latest member
WCrawford

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