Locate first instance of all dates in a column and hide all remaining rows

Darren_workforce

Board Regular
Joined
Oct 13, 2022
Messages
146
Office Version
  1. 365
Platform
  1. Windows
Hello,

I wasn't sure if this can be done with a date/time cell like below. That's how the raw data is generated and I was hoping to work with it. What I was hoping to do was scan column C, locate the first instance of each date within that column affiliated to a status of "available" in Column B, and then hide all remaining rows so that just the one row is visible. I understand that will require VBA but I was struggling on figuring out the formula needed in order to even start building a macro.

I know my dummy data is lacking but row 2 does have the first instance of 9/1/2024, however it's related column B cell displays "unavailable" so that wouldn't count. Row 3 is the first instance of 9/3/2024 and has Available in column B and so it would stay visible and all remaining rows containing 9/3/2024 would be hidden. And then the same would be done for 9/4/2024 and then all remaining dates within the range.

Can this be done or would I need to separate out the date and the time into 2 cells first?

User NameStatusStart TimeEnd Time
User NameOffline9/1/2024 12:539/3/2024 9:43
User NameAvailable9/3/2024 9:439/3/2024 9:55
User NameOn a Call9/3/2024 9:559/3/2024 10:09
User NameAfter Call Work9/3/2024 10:099/3/2024 10:11
User NameAvailable9/3/2024 10:119/3/2024 10:11
User NameAfter Call Work9/4/2024 12:179/4/2024 12:19
User NameBreak9/4/2024 12:199/4/2024 12:34
User NameAvailable9/4/2024 12:349/4/2024 12:34
User NameAvailable9/4/2024 18:319/4/2024 18:34
User NameOffline9/4/2024 18:349/5/2024 9:45
User NameAvailable9/5/2024 9:459/5/2024 9:54
User NameAfter Call Work9/9/2024 15:209/9/2024 15:22
User NameAfter Call Work9/9/2024 15:229/9/2024 15:23
User NameAvailable9/9/2024 15:229/9/2024 15:22
User NameOn a Call9/9/2024 15:239/9/2024 15:25
User NameAfter Call Work9/9/2024 15:259/9/2024 15:26
User NameOn a Call9/17/2024 12:019/17/2024 12:07
User NameAfter Call Work9/17/2024 12:079/17/2024 12:09
User NamePrjct-Email9/17/2024 12:099/17/2024 12:09
User NameAfter Call Work9/17/2024 12:099/17/2024 12:09
User NamePrjct-Email9/17/2024 12:099/17/2024 12:19
User NameAvailable9/17/2024 12:199/17/2024 12:21
User NameAvailable9/19/2024 13:499/19/2024 13:49
User NameOn a Call9/19/2024 13:499/19/2024 13:52
User NameAfter Call Work9/19/2024 13:529/19/2024 13:52
User NameOn a Call9/25/2024 11:209/25/2024 11:32
User NameAfter Call Work9/25/2024 11:329/25/2024 11:32
User NamePrjct-Email9/25/2024 11:329/25/2024 11:44
User NameAvailable9/27/2024 13:079/27/2024 13:07
User NameAfter Call Work9/27/2024 13:079/27/2024 13:07
User NameOn a Call10/1/2024 12:5310/1/2024 13:08
User NameAfter Call Work10/1/2024 13:0810/1/2024 13:08

 

Excel Facts

Quick Sum
Select a range of cells. The total appears in bottom right of Excel screen. Right-click total to add Max, Min, Count, Average.
Hello,

I wasn't sure if this can be done with a date/time cell like below. That's how the raw data is generated and I was hoping to work with it. What I was hoping to do was scan column C, locate the first instance of each date within that column affiliated to a status of "available" in Column B, and then hide all remaining rows so that just the one row is visible. I understand that will require VBA but I was struggling on figuring out the formula needed in order to even start building a macro.

I know my dummy data is lacking but row 2 does have the first instance of 9/1/2024, however it's related column B cell displays "unavailable" so that wouldn't count. Row 3 is the first instance of 9/3/2024 and has Available in column B and so it would stay visible and all remaining rows containing 9/3/2024 would be hidden. And then the same would be done for 9/4/2024 and then all remaining dates within the range.

Can this be done or would I need to separate out the date and the time into 2 cells first?

User NameStatusStart TimeEnd Time
User NameOffline9/1/2024 12:539/3/2024 9:43
User NameAvailable9/3/2024 9:439/3/2024 9:55
User NameOn a Call9/3/2024 9:559/3/2024 10:09
User NameAfter Call Work9/3/2024 10:099/3/2024 10:11
User NameAvailable9/3/2024 10:119/3/2024 10:11
User NameAfter Call Work9/4/2024 12:179/4/2024 12:19
User NameBreak9/4/2024 12:199/4/2024 12:34
User NameAvailable9/4/2024 12:349/4/2024 12:34
User NameAvailable9/4/2024 18:319/4/2024 18:34
User NameOffline9/4/2024 18:349/5/2024 9:45
User NameAvailable9/5/2024 9:459/5/2024 9:54
User NameAfter Call Work9/9/2024 15:209/9/2024 15:22
User NameAfter Call Work9/9/2024 15:229/9/2024 15:23
User NameAvailable9/9/2024 15:229/9/2024 15:22
User NameOn a Call9/9/2024 15:239/9/2024 15:25
User NameAfter Call Work9/9/2024 15:259/9/2024 15:26
User NameOn a Call9/17/2024 12:019/17/2024 12:07
User NameAfter Call Work9/17/2024 12:079/17/2024 12:09
User NamePrjct-Email9/17/2024 12:099/17/2024 12:09
User NameAfter Call Work9/17/2024 12:099/17/2024 12:09
User NamePrjct-Email9/17/2024 12:099/17/2024 12:19
User NameAvailable9/17/2024 12:199/17/2024 12:21
User NameAvailable9/19/2024 13:499/19/2024 13:49
User NameOn a Call9/19/2024 13:499/19/2024 13:52
User NameAfter Call Work9/19/2024 13:529/19/2024 13:52
User NameOn a Call9/25/2024 11:209/25/2024 11:32
User NameAfter Call Work9/25/2024 11:329/25/2024 11:32
User NamePrjct-Email9/25/2024 11:329/25/2024 11:44
User NameAvailable9/27/2024 13:079/27/2024 13:07
User NameAfter Call Work9/27/2024 13:079/27/2024 13:07
User NameOn a Call10/1/2024 12:5310/1/2024 13:08
User NameAfter Call Work10/1/2024 13:0810/1/2024 13:08

I have not got a lot of data to go on so I created some that may not be terribly realistic.

Try this.

It assumes that the data starts in A1.

It uses the integer of the date so the time is ignored.


Locate first instance of all dates in a column and hide all remaining rows.xlsm
ABCD
1User NameStatusStart TimeEnd Time
2User NamePrjct-Email01/01/202401/01/2024
3User NameAvailable01/01/202401/01/2024
4User NameAvailable01/01/202402/01/2024
5User NameOn a Call03/01/202403/01/2024
6User NameAfter Call Work03/01/202403/01/2024
7User NameOffline03/01/202403/01/2024
8User NameOn a Call03/01/202403/01/2024
9User NameBreak03/01/202403/01/2024
10User NamePrjct-Email04/01/202404/01/2024
11User NameAvailable04/01/202404/01/2024
12User NameAfter Call Work04/01/202404/01/2024
13User NameOn a Call04/01/202404/01/2024
14User NameOn a Call04/01/202404/01/2024
15User NameOffline04/01/202404/01/2024
16User NameOffline05/01/202405/01/2024
17User NamePrjct-Email06/01/202406/01/2024
18User NameBreak06/01/202406/01/2024
19User NamePrjct-Email06/01/202406/01/2024
20User NameOn a Call06/01/202406/01/2024
21User NameOn a Call06/01/202406/01/2024
22User NameOn a Call06/01/202406/01/2024
23User NamePrjct-Email06/01/202406/01/2024
24User NameAvailable07/01/202407/01/2024
25User NameOn a Call07/01/202407/01/2024
26User NameAvailable07/01/202407/01/2024
27User NameBreak07/01/202407/01/2024
28User NamePrjct-Email07/01/202407/01/2024
29User NameOffline07/01/202407/01/2024
30User NameAvailable09/01/202409/01/2024
31User NameAvailable09/01/202409/01/2024
32User NameAvailable09/01/202409/01/2024
33User NameAvailable09/01/202409/01/2024
34User NameAfter Call Work09/01/202410/01/2024
35User NameBreak10/01/202410/01/2024
36User NameBreak10/01/202410/01/2024
37User NameBreak11/01/202411/01/2024
38User NameOn a Call11/01/202411/01/2024
39User NameAfter Call Work11/01/202411/01/2024
40User NameOn a Call13/01/202413/01/2024
41User NameBreak13/01/202413/01/2024
42User NameBreak13/01/202413/01/2024
43User NameOn a Call13/01/202413/01/2024
44User NameOn a Call13/01/202413/01/2024
45User NameOffline13/01/202413/01/2024
46User NameOffline13/01/202413/01/2024
47User NameAfter Call Work14/01/202414/01/2024
48User NameOn a Call14/01/202414/01/2024
49User NameOn a Call15/01/202415/01/2024
50User NameAvailable15/01/202415/01/2024
51User NameAvailable15/01/202415/01/2024
52User NamePrjct-Email16/01/202416/01/2024
53User NameAfter Call Work16/01/202416/01/2024
54User NameAvailable16/01/202416/01/2024
55User NamePrjct-Email17/01/202417/01/2024
56User NameBreak17/01/202417/01/2024
57User NameAvailable18/01/202418/01/2024
58User NameAfter Call Work18/01/202418/01/2024
59User NameOn a Call18/01/202418/01/2024
60User NameOn a Call18/01/202418/01/2024
61User NameAvailable18/01/202418/01/2024
62User NamePrjct-Email19/01/202419/01/2024
63User NameOffline19/01/202419/01/2024
64User NameBreak20/01/202420/01/2024
65User NameAfter Call Work20/01/202420/01/2024
66User NameAfter Call Work20/01/202420/01/2024
67User NamePrjct-Email21/01/202421/01/2024
68User NamePrjct-Email21/01/202421/01/2024
69User NameOffline21/01/202421/01/2024
70User NameAfter Call Work22/01/202422/01/2024
71User NameBreak22/01/202422/01/2024
72User NameAfter Call Work22/01/202422/01/2024
73User NameAvailable22/01/202422/01/2024
74User NameOffline23/01/202423/01/2024
75User NameAvailable23/01/202423/01/2024
76User NamePrjct-Email23/01/202423/01/2024
77User NameOffline24/01/202424/01/2024
78User NameBreak24/01/202424/01/2024
79User NameBreak24/01/202424/01/2024
80User NameAvailable24/01/202424/01/2024
81User NameBreak25/01/202425/01/2024
82User NameOffline26/01/202426/01/2024
83User NameOn a Call26/01/202426/01/2024
84User NameBreak26/01/202426/01/2024
85User NameOffline26/01/202426/01/2024
86User NameAfter Call Work27/01/202427/01/2024
87User NameBreak27/01/202427/01/2024
88User NameOn a Call27/01/202427/01/2024
89User NameAvailable27/01/202427/01/2024
90User NameOn a Call27/01/202427/01/2024
91User NameOffline27/01/202427/01/2024
92User NameOn a Call27/01/202427/01/2024
93User NameAvailable28/01/202428/01/2024
94User NameOffline28/01/202428/01/2024
95User NamePrjct-Email28/01/202428/01/2024
96User NameAvailable28/01/202428/01/2024
97User NameAfter Call Work29/01/202429/01/2024
98User NameOffline29/01/202429/01/2024
99User NameOn a Call29/01/202429/01/2024
100User NameAvailable30/01/202430/01/2024
101User NameAvailable30/01/202430/01/2024
102User NameAvailable30/01/202430/01/2024
103User NameBreak30/01/202430/01/2024
104User NamePrjct-Email30/01/202430/01/2024
Sheet1


VBA Code:
Public Sub subHideAvailable()
Dim arr() As Variant
Dim strFormula As String
Dim arrUnique() As Variant
Dim i As Integer
Dim ii As Integer

  With Worksheets("Sheet1").Range("A1").CurrentRegion

    With .Resize(.Rows.Count - 1, .Columns.Count).Offset(1, 0)
    
      .EntireRow.Hidden = True
    
      ' Create a two column array with the date and row number where column B is 'Available'.
      arr = Evaluate("HSTACK(FILTER(INT(" & .Columns(3).Address & ")," & .Columns(2).Address & "=" & """Available""" & ")," & _
      "FILTER(ROW(" & .Columns(1).Address & ")," & .Columns(2).Address & "=" & """Available""" & "))")
    
      ' Create a one column array of unique date values where column B is 'Available'.
      arrUnique = Evaluate("UNIQUE(FILTER(INT(" & .Columns(3).Address & ")," & .Columns(2).Address & "=" & """Available""" & "))")
      
      For i = LBound(arrUnique) To UBound(arrUnique)
        For ii = LBound(arr) To UBound(arr)
          If arr(ii, 1) = arrUnique(i, 1) Then
            Cells(arr(ii, 2), 2).EntireRow.Hidden = False
            Exit For
          End If
        Next
      Next i
    
    End With

  End With
    
End Sub
 
Upvote 0
Is it my understanding that you want to see only available users on a certain date or range of dates. Would you be able to provide an example of what that UserName data may look like?
 
Upvote 0
Hello,

I wasn't sure if this can be done with a date/time cell like below. That's how the raw data is generated and I was hoping to work with it. What I was hoping to do was scan column C, locate the first instance of each date within that column affiliated to a status of "available" in Column B, and then hide all remaining rows so that just the one row is visible. I understand that will require VBA but I was struggling on figuring out the formula needed in order to even start building a macro.

I know my dummy data is lacking but row 2 does have the first instance of 9/1/2024, however it's related column B cell displays "unavailable" so that wouldn't count. Row 3 is the first instance of 9/3/2024 and has Available in column B and so it would stay visible and all remaining rows containing 9/3/2024 would be hidden. And then the same would be done for 9/4/2024 and then all remaining dates within the range.

Can this be done or would I need to separate out the date and the time into 2 cells first?

User NameStatusStart TimeEnd Time
User NameOffline9/1/2024 12:539/3/2024 9:43
User NameAvailable9/3/2024 9:439/3/2024 9:55
User NameOn a Call9/3/2024 9:559/3/2024 10:09
User NameAfter Call Work9/3/2024 10:099/3/2024 10:11
User NameAvailable9/3/2024 10:119/3/2024 10:11
User NameAfter Call Work9/4/2024 12:179/4/2024 12:19
User NameBreak9/4/2024 12:199/4/2024 12:34
User NameAvailable9/4/2024 12:349/4/2024 12:34
User NameAvailable9/4/2024 18:319/4/2024 18:34
User NameOffline9/4/2024 18:349/5/2024 9:45
User NameAvailable9/5/2024 9:459/5/2024 9:54
User NameAfter Call Work9/9/2024 15:209/9/2024 15:22
User NameAfter Call Work9/9/2024 15:229/9/2024 15:23
User NameAvailable9/9/2024 15:229/9/2024 15:22
User NameOn a Call9/9/2024 15:239/9/2024 15:25
User NameAfter Call Work9/9/2024 15:259/9/2024 15:26
User NameOn a Call9/17/2024 12:019/17/2024 12:07
User NameAfter Call Work9/17/2024 12:079/17/2024 12:09
User NamePrjct-Email9/17/2024 12:099/17/2024 12:09
User NameAfter Call Work9/17/2024 12:099/17/2024 12:09
User NamePrjct-Email9/17/2024 12:099/17/2024 12:19
User NameAvailable9/17/2024 12:199/17/2024 12:21
User NameAvailable9/19/2024 13:499/19/2024 13:49
User NameOn a Call9/19/2024 13:499/19/2024 13:52
User NameAfter Call Work9/19/2024 13:529/19/2024 13:52
User NameOn a Call9/25/2024 11:209/25/2024 11:32
User NameAfter Call Work9/25/2024 11:329/25/2024 11:32
User NamePrjct-Email9/25/2024 11:329/25/2024 11:44
User NameAvailable9/27/2024 13:079/27/2024 13:07
User NameAfter Call Work9/27/2024 13:079/27/2024 13:07
User NameOn a Call10/1/2024 12:5310/1/2024 13:08
User NameAfter Call Work10/1/2024 13:0810/1/2024 13:08

Version 2 now.

Assumes Sheet1 and data starts in A1.

Locate first instance of all dates in a column and hide all remaining rows.xlsm
ABCD
1User NameStatusStart TimeEnd Time
2User NamePrjct-Email01/01/202401/01/2024
3User NameAvailable01/01/202401/01/2024
4User NameAvailable01/01/202402/01/2024
5User NameOn a Call03/01/202403/01/2024
6User NameAfter Call Work03/01/202403/01/2024
7User NameOffline03/01/202403/01/2024
8User NameOn a Call03/01/202403/01/2024
9User NameBreak03/01/202403/01/2024
10User NamePrjct-Email04/01/202404/01/2024
11User NameAvailable04/01/202404/01/2024
12User NameAfter Call Work04/01/202404/01/2024
13User NameOn a Call04/01/202404/01/2024
14User NameOn a Call04/01/202404/01/2024
15User NameOffline04/01/202404/01/2024
16User NameOffline05/01/202405/01/2024
17User NamePrjct-Email06/01/202406/01/2024
18User NameBreak06/01/202406/01/2024
19User NamePrjct-Email06/01/202406/01/2024
20User NameOn a Call06/01/202406/01/2024
21User NameOn a Call06/01/202406/01/2024
22User NameOn a Call06/01/202406/01/2024
23User NamePrjct-Email06/01/202406/01/2024
24User NameAvailable07/01/202407/01/2024
25User NameOn a Call07/01/202407/01/2024
26User NameAvailable07/01/202407/01/2024
27User NameBreak07/01/202407/01/2024
28User NamePrjct-Email07/01/202407/01/2024
29User NameOffline07/01/202407/01/2024
30User NameAvailable09/01/202409/01/2024
31User NameAvailable09/01/202409/01/2024
32User NameAvailable09/01/202409/01/2024
33User NameAvailable09/01/202409/01/2024
34User NameAfter Call Work09/01/202410/01/2024
35User NameBreak10/01/202410/01/2024
36User NameBreak10/01/202410/01/2024
37User NameBreak11/01/202411/01/2024
38User NameOn a Call11/01/202411/01/2024
39User NameAfter Call Work11/01/202411/01/2024
40User NameOn a Call13/01/202413/01/2024
41User NameBreak13/01/202413/01/2024
42User NameBreak13/01/202413/01/2024
43User NameOn a Call13/01/202413/01/2024
44User NameOn a Call13/01/202413/01/2024
45User NameOffline13/01/202413/01/2024
46User NameOffline13/01/202413/01/2024
47User NameAfter Call Work14/01/202414/01/2024
48User NameOn a Call14/01/202414/01/2024
49User NameOn a Call15/01/202415/01/2024
50User NameAvailable15/01/202415/01/2024
51User NameAvailable15/01/202415/01/2024
52User NamePrjct-Email16/01/202416/01/2024
53User NameAfter Call Work16/01/202416/01/2024
54User NameAvailable16/01/202416/01/2024
55User NamePrjct-Email17/01/202417/01/2024
56User NameBreak17/01/202417/01/2024
57User NameAvailable18/01/202418/01/2024
58User NameAfter Call Work18/01/202418/01/2024
59User NameOn a Call18/01/202418/01/2024
60User NameOn a Call18/01/202418/01/2024
61User NameAvailable18/01/202418/01/2024
62User NamePrjct-Email19/01/202419/01/2024
63User NameOffline19/01/202419/01/2024
64User NameBreak20/01/202420/01/2024
65User NameAfter Call Work20/01/202420/01/2024
66User NameAfter Call Work20/01/202420/01/2024
67User NamePrjct-Email21/01/202421/01/2024
68User NamePrjct-Email21/01/202421/01/2024
69User NameOffline21/01/202421/01/2024
70User NameAfter Call Work22/01/202422/01/2024
71User NameBreak22/01/202422/01/2024
72User NameAfter Call Work22/01/202422/01/2024
73User NameAvailable22/01/202422/01/2024
74User NameOffline23/01/202423/01/2024
75User NameAvailable23/01/202423/01/2024
76User NamePrjct-Email23/01/202423/01/2024
77User NameOffline24/01/202424/01/2024
78User NameBreak24/01/202424/01/2024
79User NameBreak24/01/202424/01/2024
80User NameAvailable24/01/202424/01/2024
81User NameBreak25/01/202425/01/2024
82User NameOffline26/01/202426/01/2024
83User NameOn a Call26/01/202426/01/2024
84User NameBreak26/01/202426/01/2024
85User NameOffline26/01/202426/01/2024
86User NameAfter Call Work27/01/202427/01/2024
87User NameBreak27/01/202427/01/2024
88User NameOn a Call27/01/202427/01/2024
89User NameAvailable27/01/202427/01/2024
90User NameOn a Call27/01/202427/01/2024
91User NameOffline27/01/202427/01/2024
92User NameOn a Call27/01/202427/01/2024
93User NameAvailable28/01/202428/01/2024
94User NameOffline28/01/202428/01/2024
95User NamePrjct-Email28/01/202428/01/2024
96User NameAvailable28/01/202428/01/2024
97User NameAfter Call Work29/01/202429/01/2024
98User NameOffline29/01/202429/01/2024
99User NameOn a Call29/01/202429/01/2024
100User NameAvailable30/01/202430/01/2024
101User NameAvailable30/01/202430/01/2024
102User NameAvailable30/01/202430/01/2024
103User NameBreak30/01/202430/01/2024
104User NamePrjct-Email30/01/202430/01/2024
Sheet1


VBA Code:
Public Sub subHideAvailableVersion2()
Dim i As Integer
Dim dict As Object
Dim arr() As Variant

  Set dict = CreateObject("Scripting.Dictionary")
    
  arr = Worksheets("Sheet1").Range("A1").CurrentRegion.Value
  
  Cells.EntireRow.Hidden = True
  
  Cells(1, 2).EntireRow.Hidden = False
  
  For i = 2 To UBound(arr)
  
    If arr(i, 2) = "Available" And Not dict.exists(arr(i, 3)) Then
      
      dict.Add Key:=arr(i, 3), Item:=dict.Count + 1
            
      Cells(i, 2).EntireRow.Hidden = False
      
    End If
    
  Next i
  
End Sub
 
Upvote 0
I understand that will require VBA
I'm not so sure. Would either of these non-macro approaches be of interest?

The first idea is not to hide any rows at all but simply show only the relevant rows in another location.
My understanding is that it is the green rows that you want to see. If that is so, the the formula in F2 below produces just that data in columns F:I

24 10 31.xlsm
ABCDEFGHI
1User NameStatusStart TimeEnd TimeUser NameStatusStart TimeEnd Time
2User NameOffline1/09/2024 12:533/09/2024 9:43User NameAvailable3/09/2024 9:433/09/2024 9:55
3User NameAvailable3/09/2024 9:433/09/2024 9:55User NameAvailable4/09/2024 12:344/09/2024 12:34
4User NameOn a Call3/09/2024 9:553/09/2024 10:09User NameAvailable5/09/2024 9:455/09/2024 9:54
5User NameAfter Call Work3/09/2024 10:093/09/2024 10:11User NameAvailable9/09/2024 15:229/09/2024 15:22
6User NameAvailable3/09/2024 10:113/09/2024 10:11User NameAvailable17/09/2024 12:1917/09/2024 12:21
7User NameAfter Call Work4/09/2024 12:174/09/2024 12:19User NameAvailable19/09/2024 13:4919/09/2024 13:49
8User NameBreak4/09/2024 12:194/09/2024 12:34User NameAvailable27/09/2024 13:0727/09/2024 13:07
9User NameAvailable4/09/2024 12:344/09/2024 12:34
10User NameAvailable4/09/2024 18:314/09/2024 18:34
11User NameOffline4/09/2024 18:345/09/2024 9:45
12User NameAvailable5/09/2024 9:455/09/2024 9:54
13User NameAfter Call Work9/09/2024 15:209/09/2024 15:22
14User NameAfter Call Work9/09/2024 15:229/09/2024 15:23
15User NameAvailable9/09/2024 15:229/09/2024 15:22
16User NameOn a Call9/09/2024 15:239/09/2024 15:25
17User NameAfter Call Work9/09/2024 15:259/09/2024 15:26
18User NameOn a Call17/09/2024 12:0117/09/2024 12:07
19User NameAfter Call Work17/09/2024 12:0717/09/2024 12:09
20User NamePrjct-Email17/09/2024 12:0917/09/2024 12:09
21User NameAfter Call Work17/09/2024 12:0917/09/2024 12:09
22User NamePrjct-Email17/09/2024 12:0917/09/2024 12:19
23User NameAvailable17/09/2024 12:1917/09/2024 12:21
24User NameAvailable19/09/2024 13:4919/09/2024 13:49
25User NameOn a Call19/09/2024 13:4919/09/2024 13:52
26User NameAfter Call Work19/09/2024 13:5219/09/2024 13:52
27User NameOn a Call25/09/2024 11:2025/09/2024 11:32
28User NameAfter Call Work25/09/2024 11:3225/09/2024 11:32
29User NamePrjct-Email25/09/2024 11:3225/09/2024 11:44
30User NameAvailable27/09/2024 13:0727/09/2024 13:07
31User NameAfter Call Work27/09/2024 13:0727/09/2024 13:07
32User NameOn a Call1/10/2024 12:531/10/2024 13:08
33User NameAfter Call Work1/10/2024 13:081/10/2024 13:08
Hide rows
Cell Formulas
RangeFormula
F2:I8F2=LET(a,FILTER(A2:D33,B2:B33="Available"),st,INDEX(a,0,3),FILTER(a,(INDEX(a,0,2)="Available")*(st=XLOOKUP(INT(st),INT(st),st))))
Dynamic array formulas.



My second idea does actually hide the rows.
For my layout

24 10 31.xlsm
ABCDEFGH
1User NameStatusStart TimeEnd Time
2User NameOffline1/09/2024 12:533/09/2024 9:43#N/A
3User NameAvailable3/09/2024 9:433/09/2024 9:55
4User NameOn a Call3/09/2024 9:553/09/2024 10:09
5User NameAfter Call Work3/09/2024 10:093/09/2024 10:11
6User NameAvailable3/09/2024 10:113/09/2024 10:11
7User NameAfter Call Work4/09/2024 12:174/09/2024 12:19
8User NameBreak4/09/2024 12:194/09/2024 12:34
9User NameAvailable4/09/2024 12:344/09/2024 12:34
10User NameAvailable4/09/2024 18:314/09/2024 18:34
11User NameOffline4/09/2024 18:345/09/2024 9:45
12User NameAvailable5/09/2024 9:455/09/2024 9:54
13User NameAfter Call Work9/09/2024 15:209/09/2024 15:22
14User NameAfter Call Work9/09/2024 15:229/09/2024 15:23
15User NameAvailable9/09/2024 15:229/09/2024 15:22
16User NameOn a Call9/09/2024 15:239/09/2024 15:25
17User NameAfter Call Work9/09/2024 15:259/09/2024 15:26
18User NameOn a Call17/09/2024 12:0117/09/2024 12:07
19User NameAfter Call Work17/09/2024 12:0717/09/2024 12:09
20User NamePrjct-Email17/09/2024 12:0917/09/2024 12:09
21User NameAfter Call Work17/09/2024 12:0917/09/2024 12:09
22User NamePrjct-Email17/09/2024 12:0917/09/2024 12:19
23User NameAvailable17/09/2024 12:1917/09/2024 12:21
24User NameAvailable19/09/2024 13:4919/09/2024 13:49
25User NameOn a Call19/09/2024 13:4919/09/2024 13:52
26User NameAfter Call Work19/09/2024 13:5219/09/2024 13:52
27User NameOn a Call25/09/2024 11:2025/09/2024 11:32
28User NameAfter Call Work25/09/2024 11:3225/09/2024 11:32
29User NamePrjct-Email25/09/2024 11:3225/09/2024 11:44
30User NameAvailable27/09/2024 13:0727/09/2024 13:07
31User NameAfter Call Work27/09/2024 13:0727/09/2024 13:07
32User NameOn a Call1/10/2024 12:531/10/2024 13:08
33User NameAfter Call Work1/10/2024 13:081/10/2024 13:08
Hide rows (2)
Cell Formulas
RangeFormula
H2H2=MATCH("Available"&INT(C2),B$2:B$33&INT(C$2:C$33),0)=ROW(C2)-ROW(C$2)+1

  • Put the formula shown in H2 (H1 must be empty
  • Select the data (A1:D33 for me)
  • On the Data ribbon tab select 'Advanced' in the 'sort & Filter' section
  • Complete the dialog as shown below (note the Criteria range includes the empty cell H1) and then click OK
1730368707338.png


Here is the result for me

24 10 31.xlsm
ABCD
1User NameStatusStart TimeEnd Time
3User NameAvailable3/09/2024 9:433/09/2024 9:55
9User NameAvailable4/09/2024 12:344/09/2024 12:34
12User NameAvailable5/09/2024 9:455/09/2024 9:54
15User NameAvailable9/09/2024 15:229/09/2024 15:22
23User NameAvailable17/09/2024 12:1917/09/2024 12:21
24User NameAvailable19/09/2024 13:4919/09/2024 13:49
30User NameAvailable27/09/2024 13:0727/09/2024 13:07
34
Hide rows (2)


To unhide the rows again click 'Clear' in the 'Sort & Filter' section of the 'data' ribbon tab.

N.B. Both of the above approaches could be implemented by vba if you really want/need that.
 
Upvote 0

Forum statistics

Threads
1,223,914
Messages
6,175,353
Members
452,638
Latest member
Oluwabukunmi

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