Solved

Conditional formatting for duplicates and all numbers in a table

Posted on 2011-02-15
7
369 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
The Eight Noble Truths of Backup and Recovery

How can IT departments tackle the challenges of a Big Data world? This white paper provides a roadmap to success and helps companies ensure that all their data is safe and secure, no matter if it resides on-premise with physical or virtual machines or in the cloud.

 

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 500 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

Ransomware: The New Cyber Threat & How to Stop It

This infographic explains ransomware, type of malware that blocks access to your files or your systems and holds them hostage until a ransom is paid. It also examines the different types of ransomware and explains what you can do to thwart this sinister online threat.  

Question has a verified solution.

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

Suggested Solutions

Title # Comments Views Activity
combine fist two words in a cell 2 25
A Table within a User Form 24 44
Cost allcocation ... 10 23
simple excel formula 4 16
User Beware!  This is a rather permanent solution to removing your email from an exchange server.  The only way to truly go back is to have your exchange administrator restore your mailbox from backups.  This is usually the option of last resort.  A…
This collection of functions covers all the normal rounding methods of just about any numeric value.
The viewer will learn how to create a normally distributed random variable in Excel, use a normal distribution to simulate the return on an investment over a period of years, Create a Monte Carlo simulation using a normal random variable, and calcul…
Many functions in Excel can make decisions. The most simple of these is the IF function: it returns a value depending on whether a condition you describe is true or false. Once you get the hang of using the IF function, you will find it easier to us…

828 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