?
Solved

Conditional formatting for duplicates and all numbers in a table

Posted on 2011-02-15
7
Medium Priority
?
404 Views
Last Modified: 2012-05-11
I have a very simple, but important task. I have attached a sheet and in that sheet I have a list of numbers in order. These numbers are station numbers that are used in a sequence to determine which station are dispatched to runs. I have about 200 sheets that I have to enter these station run numbers in various sequences.

It is very very important that each of the numbers shows up in each sheet. It is equal as important that I do no duplicate any numbers while enter them. I will make a validation list, so only these numbers will be accepted.

My questions is can I do some type of conditional formatting or validation so I don't repeat any numbers or I don't forget any numbers in each sheet?

Thanks for any help.

Brent RUN-ORDER.xls
0
Comment
Question by:bvanscoy678
  • 3
  • 3
7 Comments
 
LVL 24

Expert Comment

by:StephenJR
ID: 34897150
Do you enter the sequences manually?
0
 

Author Comment

by:bvanscoy678
ID: 34897258
Yes, I enter the sequence manually.
0
 
LVL 24

Expert Comment

by:StephenJR
ID: 34897288
Don't know if this is feasible for your actual file, but will produce a sheet at the end listing errors.
Sub x()

Dim ws As Worksheet, v, i As Long, vOut(), n As Long

v = Array(3, 31, 33, 1, 30, 34, 51, 5, 24, 61, 21, 22, 41, _
          53, 23, 52, 60, 42, 65, 43, 63, 56, 44, 77, 45, _
          "B1", "B3", "B2", "B5", "B6", "B4")
          
ReDim Preserve vOut(1 To Worksheets.Count * UBound(v), 1 To 3)

For Each ws In Worksheets
    For i = LBound(v) To UBound(v)
        If ws.UsedRange.Find(What:=v(i), Lookat:=xlWhole) Is Nothing Then
            n = n + 1
            vOut(n, 1) = ws.Name
            vOut(n, 2) = v(i)
        End If
        If WorksheetFunction.CountIf(ws.UsedRange, v(i)) > 1 Then
            n = n + 1
            vOut(n, 1) = ws.Name
            vOut(n, 3) = v(i)
        End If
    Next i
Next ws

Sheets.Add(After:=Sheets(Sheets.Count)).Name = "Errors"
With Sheets("Errors")
    .Range("A1").Resize(, 3) = Array("Sheet", "Not found", "Duplicate")
    .Range("A2").Resize(n, 3) = vOut
End With

End Sub

Open in new window

0
Veeam Disaster Recovery in Microsoft Azure

Veeam PN for Microsoft Azure is a FREE solution designed to simplify and automate the setup of a DR site in Microsoft Azure using lightweight software-defined networking. It reduces the complexity of VPN deployments and is designed for businesses of ALL sizes.

 

Author Comment

by:bvanscoy678
ID: 34898197
I'll be honest, this solution is a little difficult for me to understand.
0
 
LVL 42

Accepted Solution

by:
dlmille earned 2000 total points
ID: 34898783
Use this tip to avoid entering duplicate values in a row with data validation:

http://www.contextures.com/xlDataVal07.html#Unique
It uses the approach to count the number of entries like the one you're entering in a range and if > 1 then doesn't let you enter the value.

Dave
0
 
LVL 24

Expert Comment

by:StephenJR
ID: 34898868
Happy to try to explain if you think it's an approach you want to pursue, there will be others.
0
 

Author Comment

by:bvanscoy678
ID: 34902025
Yes, that will work fine.

Thanks for the offer to explain, but seems it works just fine.

Thanks
0

Featured Post

How to Use the Help Bell

Need to boost the visibility of your question for solutions? Use the Experts Exchange Help Bell to confirm priority levels and contact subject-matter experts for question attention.  Check out this how-to article for more information.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Having trouble getting your hands on Dynamics 365 Field Service or Project Service trial? Worry No More!!!
This article describes how to use a set of graphical playing cards to create a Draw Poker game in Excel or VB6.
The viewer will learn how to use a discrete random variable to simulate the return on an investment over a period of years, create a Monte Carlo simulation using the discrete random variable, and create a graph to represent the possible returns over…
This Micro Tutorial will demonstrate the scrolling table in Microsoft Excel using the INDEX function.

840 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question