How to make a drop down list that hides previously used items in just the same row

Trying to make a drop down list that will hide a previously used item in the same row, it can repeat
in each column. The first Column is just heading, all items for lists are on a second sheet from A1 to
A13.The drop down list is from b2 to e2 then have it start over for each column. I've looked at a bunch
of guides on this, but they're all on columns, not rows, so basically trying to find a formula or data function at will hide items used per row.

example: sheet 1
      A          B           C          D         E   
1   time     Coach   Coach    Coach    Coach
2   4:00     Floor     Beam     Bars     Pommel
3   4:15     Vault     Floor     Tramp   Bars

sheet 2
     A
1  Floor
2  Beam
3  Vault
4  Bars
5  Tramp



Assuming your data is from A1:N4, where row 1 is the header and column A is the time slot.
I assume that requirement is "Not to allow repetition in the same row as well as in the same column"
It can achieved by data validation.

Select the range B2:N4,  cursor on cell B2.  Go to data validation/In Allow tab choose Custom and in formula tab give this formula
=AND(COUNTIF($B2:$N2,B2)=1,COUNTIF(B$2:B$4,B2)=1)
Then click Ok and come out of Data Validation

It will ensure that no item is repeated in same row as well as same column. 
You may also give error message, if desired

Range can be changed as per requirement.

Also find a link to see it.
http://sdrv.ms/18gKuUA


Vijay

Was this reply helpful?

Sorry this didn't help.

Great! Thanks for your feedback.

How satisfied are you with this reply?

Thanks for your feedback, it helps us improve the site.

How satisfied are you with this reply?

Thanks for your feedback.

Hi,
Perhaps this
use conditional formatting with dropdown list > select range > Duplicate

or
Use data validation without dropdown list (you have to mannuLly enter the name> custom >formula :
COUNTIF($A$1:$A$3,A1)=1

Regard







 

Was this reply helpful?

Sorry this didn't help.

Great! Thanks for your feedback.

How satisfied are you with this reply?

Thanks for your feedback, it helps us improve the site.

How satisfied are you with this reply?

Thanks for your feedback.

Assuming your data is from A1:N4, where row 1 is the header and column A is the time slot.
I assume that requirement is "Not to allow repetition in the same row as well as in the same column"
It can achieved by data validation.

Select the range B2:N4,  cursor on cell B2.  Go to data validation/In Allow tab choose Custom and in formula tab give this formula
=AND(COUNTIF($B2:$N2,B2)=1,COUNTIF(B$2:B$4,B2)=1)
Then click Ok and come out of Data Validation

It will ensure that no item is repeated in same row as well as same column. 
You may also give error message, if desired

Range can be changed as per requirement.

Also find a link to see it.
http://sdrv.ms/18gKuUA







That works, though I have to change the formula for each row, is there a way to use this function and
have a drop down list at the time? That would be helpful.


Was this reply helpful?

Sorry this didn't help.

Great! Thanks for your feedback.

How satisfied are you with this reply?

Thanks for your feedback, it helps us improve the site.

How satisfied are you with this reply?

Thanks for your feedback.


That works, though I have to change the formula for each row, is there a way to use this function and 
have a drop down list at the time? That would be helpful. 

I don't think there is any need to change the formula for each row, as I have made the rows partially dynamic so it will work with same formula. You may add/delete  row or columns in the linked file, and it will adjust accordingly.

There is no issue in creating drop down list, for time cell, but it will not be possible for other cells in row as already we have a data validation.
Vijay

Was this reply helpful?

Sorry this didn't help.

Great! Thanks for your feedback.

How satisfied are you with this reply?

Thanks for your feedback, it helps us improve the site.

How satisfied are you with this reply?

Thanks for your feedback.

Trying to make a drop down list that will hide a previously used item in the same row,........

Hi,

it's not what you want to accomplish
but try this...

Instead of hide a previously used item, from a drop down list

If you try to add an existing item, twice,
then you have a message...

[update: July 23, 2017....]

Private Sub Worksheet_Change(ByVal Target As Range)

'horizontal

On Error Resume Next
Dim c1 As Long, c2 As Long
Dim rng As Range
Set rng = Range("A1:D5") 'range/drop down list
c1 = rng.Column
c2 = rng.Columns.Count
If Not Intersect(Target, rng) Is Nothing Then
For Each r In Cells(Target.Row, c1).Resize(, c2) 'new line
If Target.Value = "" Then Exit Sub
If r.Address <> Target.Address And r.Value = Target.Value Then
MsgBox "wrong"
Target.Value = ""
Exit Sub
End If
Next
End If
On Error GoTo 0
End Sub

...http://youtu.be/6Ooglyh3clM

--------------------------------
Microsoft365 on Windows 10
---------------------------------

1 person found this reply helpful

·

Was this reply helpful?

Sorry this didn't help.

Great! Thanks for your feedback.

How satisfied are you with this reply?

Thanks for your feedback, it helps us improve the site.

How satisfied are you with this reply?

Thanks for your feedback.

Hi, Thank you for the source for VB, but I am wondering how would I edit this same code so instead of reducing duplicate through row (horizontal), it prevent duplicate across column (vertical) instead? 

Was this reply helpful?

Sorry this didn't help.

Great! Thanks for your feedback.

How satisfied are you with this reply?

Thanks for your feedback, it helps us improve the site.

How satisfied are you with this reply?

Thanks for your feedback.

Hi,

try this approach....

(I assume that you have a drop down list with 5 or more unique items

since you have 5 rows)

[update: July 23, 2017.....]

Private Sub Worksheet_Change(ByVal Target As Range)
'vertical
On Error Resume Next
Dim r1 As Long, r2 As Long
Dim rng As Range
Set rng = Range("A1:D5") '<< range/drop down list 
r1 = rng.Row
r2 = rng.Rows.Count
If Not Intersect(Target, rng) Is Nothing Then
For Each r In Cells(r1, Target.Column).Resize(r2) 'new line
If Target.Value = "" Then Exit Sub
If r.Address <> Target.Address And r.Value = Target.Value Then
MsgBox "wrong"
Target.Value = ""
Exit Sub
End If
Next
End If
On Error GoTo 0
End Sub


https://youtu.be/d6wN93esJqQ

--------------------------------
Microsoft365 on Windows 10
---------------------------------

Was this reply helpful?

Sorry this didn't help.

Great! Thanks for your feedback.

How satisfied are you with this reply?

Thanks for your feedback, it helps us improve the site.

How satisfied are you with this reply?

Thanks for your feedback.

 
 

Question Info


Last updated April 4, 2024 Views 5,758 Applies to: