Find first TRUE value each week

rongil20

New Member
Joined
Jun 23, 2015
Messages
12
[TABLE="width: 500"]
<tbody>[TR]
[TD]Week No
[/TD]
[TD]Match
[/TD]
[TD]Result
[/TD]
[/TR]
[TR]
[TD]1
[/TD]
[TD]FALSE
[/TD]
[TD][/TD]
[/TR]
[TR]
[TD]1
[/TD]
[TD]TRUE
[/TD]
[TD]YES
[/TD]
[/TR]
[TR]
[TD]1
[/TD]
[TD]TRUE
[/TD]
[TD][/TD]
[/TR]
[TR]
[TD]2
[/TD]
[TD]TRUE
[/TD]
[TD]YES
[/TD]
[/TR]
[TR]
[TD]2
[/TD]
[TD]FALSE
[/TD]
[TD][/TD]
[/TR]
[TR]
[TD]2
[/TD]
[TD]TRUE
[/TD]
[TD][/TD]
[/TR]
[TR]
[TD]2
[/TD]
[TD]FALSE
[/TD]
[TD][/TD]
[/TR]
[TR]
[TD]3
[/TD]
[TD]FALSE
[/TD]
[TD][/TD]
[/TR]
[TR]
[TD]3
[/TD]
[TD]TRUE
[/TD]
[TD]YES
[/TD]
[/TR]
[TR]
[TD]4
[/TD]
[TD]FALSE
[/TD]
[TD][/TD]
[/TR]
[TR]
[TD]4
[/TD]
[TD]FALSE
[/TD]
[TD][/TD]
[/TR]
[TR]
[TD]4
[/TD]
[TD]TRUE
[/TD]
[TD]YES
[/TD]
[/TR]
[TR]
[TD]5
[/TD]
[TD]TRUE
[/TD]
[TD]YES
[/TD]
[/TR]
[TR]
[TD]5
[/TD]
[TD]TRUE
[/TD]
[TD][/TD]
[/TR]
</tbody>[/TABLE]

Hi, I am trying to find a way to get the third column in the above dataset to find the first TRUE value in each week (which I have manually done myself above).

Obviously I need a macro but no idea where to even begin with this, any help much appreciated.

Thanks
 

Excel Facts

How can you turn a range sideways?
Copy the range. Select a blank cell. Right-click, Paste Special, then choose Transpose.
Try:
Code:
Sub findTrue()
    Application.ScreenUpdating = False
    Dim LastRow As Long
    LastRow = Sheets("Sheet1").Cells.Find("*", SearchOrder:=xlByRows, SearchDirection:=xlPrevious).Row
    Dim rng As Range
    Dim rngUniques As Range
    Dim foundVal As Range
    Sheets("Sheet1").Range("A1:A" & LastRow).AdvancedFilter Action:=xlFilterInPlace, CriteriaRange:=Range _
        ("A1:A" & LastRow), Unique:=True
    Set rngUniques = Sheets("Sheet1").Range("A2:A" & LastRow).SpecialCells(xlCellTypeVisible)
    For Each rng In rngUniques
        Range("A1:C" & LastRow).AutoFilter Field:=1, Criteria1:=rng
        Set foundVal = Range("B:B").SpecialCells(xlCellTypeVisible).Find("TRUE")
        If Not foundVal Is Nothing Then
            foundVal.Offset(0, 1) = "YES"
        End If
    Next rng
    If Sheets("Sheet1").AutoFilterMode = True Then Sheets("Sheet1").AutoFilterMode = False
    Application.ScreenUpdating = False
End Sub
 
Upvote 0

Forum statistics

Threads
1,224,823
Messages
6,181,176
Members
453,021
Latest member
Justyna P

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