Check if duplicate row below + highlight

g0d0rz

New Member
Joined
Sep 20, 2014
Messages
3
Hi guys,

I need your help, I need to achieve the following:

Time1 or 0
500
601
701
800

<tbody>
</tbody>

I have two columns, first one displays a date with time, second one displays 1 or 0. I need to check if there are two 1s below each other.

As in the example, they would have to color red.

Two 0s under each other is not a problem, only the 1s.

Second question would be, what would be a good way to show this in a graph? Only highlighting the wrong ones?

Thanks guys!!:confused:
 

Excel Facts

What is the fastest way to copy a formula?
If A2:A50000 contain data. Enter a formula in B2. Select B2. Double-click the Fill Handle and Excel will shoot the formula down to B50000.
This will find and color the 1s. Assuming columns A and B
Code:
Sub dupOnes()
Dim sh As Worksheet, lr As Long, c As Range
Set sh = Sheets(1) 'Edit sheet name
lr = sh.Cells(Rows.Count, 2).End(xlUp).Row
    For Each c In Range("B2:B" & lr - 1)
        If c = 1 And c.Offset(1, 0) = 1 Then
            c.Resize(2, 1).Font.Color = vbRed
        End If
    Next
End Sub
As for the charting, you need to define what it is you are charting. ie. Frequency, percentage, etc. Once you know what you are charting, the rest is just a matter of taking the data from the results and put it in a range somewhere.
 
Upvote 0
Hi thanks for your help! I am unable to get the code working.

Attached is the excel file, column E is the grand total and should not be used?
The red circles are the bad ones and should be measured. Any idea on how to show this in a graph?

excel.jpg


Only the first and last 1 is good, all the rest should be red.

Thanks!
 
Upvote 0
This screen shot does not coincide with the OP description of what you want to do. There are four columns of data in the screen shot and the two of interest are not specified.
 
Upvote 0
My apologies, I thought it would be easier to post it like that so I could modify the macro myself, unfortunately I was wrong.
 
Upvote 0

Forum statistics

Threads
1,214,790
Messages
6,121,607
Members
449,037
Latest member
Arbind kumar

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