Find out missing name or entity is in between months

James Clear

Board Regular
Joined
Jul 12, 2021
Messages
139
Office Version
  1. 365
  2. 2016
  3. 2013
  4. 2010
Platform
  1. Windows
How will I find out that Rahul name was present in Aug to Oct and then in Dec'21 , however same was missing in between Nov'21 month

Imagine there are thousands or lakhs of names and i have to find out such names with the months , how will i do it with excel formula ? pls assist

NameMonth
Rahul
Aug-21​
Rahul
Sep-21​
Rahul
Oct-21​
Atul
Nov-21​
Rahul
Dec-21​
 
Actually goal is like

Rahul is present from Aug to Oct however all of sudden missing in NoV n present in December but practically it’s not possible that it should not be available in the month of NOV so I have to derive name Rahul differently in such way I have 3 L rows
 
Upvote 0

Excel Facts

Waterfall charts in Excel?
Office 365 customers have access to Waterfall charts since late 2016. They were added to Excel 2019.
with you thousands names, you want a count per month, 12,345 in September, 13,541 in October, ... ?
 
Upvote 0
with you thousands names, you want a count per month, 12,345 in September, 13,541 in October, ... ?
No, for example one name let us say XYZ is available in data against aug to October but suddenly got disappeared in the month of November and then all of sudden appeared in the month of December…. So my goal is to find out such ppl from the data where these are not available in the middle however they appear after month’s gap
 
Upvote 0
Column A:B random names and months
Tbl_Bitwise (Column D:E) = all the names, 0=absent,1=present
Tbl_Missing (Columns F:G) = persons missing in a month
Pivottable = summary, number of persons missing per month
VBA Code:
Sub test()
     t = Timer
     Set dict = CreateObject("scripting.dictionary")
     dict.CompareMode = vbTextCompare

     a = Sheets("james").Range("A1").CurrentRegion.Value2       'read to an array
     mymin = Application.Min(Application.Index(a, 0, 2))        'smallest
     mymax = Application.Max(Application.Index(a, 0, 2))        'greatest
     Delta = WorksheetFunction.Round((mymax - mymin) / 30.5, 0) + 1     'number of months
     s0 = "'" & WorksheetFunction.Rept("0", Delta)              'startstring

     For i = 2 To UBound(a)
          If Not dict.exists(a(i, 1)) Then dict.Add a(i, 1), Array(a(i, 1), s0)     'does name already exist in dict, if not add
          it = dict(a(i, 1))                                    'item for that name
          j = WorksheetFunction.Round((a(i, 2) - mymin) / 30.5, 0) + 2     ' that month is character j in the string
          it(1) = Left(it(1), j - 1) & "1" & Mid(it(1), j + 1)  'replace that char with a "1"
          dict(a(i, 1)) = it                                    'write back to dict
     Next

     a = Application.Index(dict.items, 0, 0)
     With Range("D2").ListObject
          If .ListRows.Count Then .DataBodyRange.Delete
          .ListRows.Add.Range.Range("A1").Resize(dict.Count, 2).Value = Application.Index(dict.items, 0, 0)
          .Range.EntireColumn.AutoFit
     End With

     dict.RemoveAll
     For i = 1 To UBound(a)
          For j = 1 To Len(a(i, 2))
               If Mid(a(i, 2), j, 1) = "0" Then dict.Add dict.Count, Array(a(i, 1), WorksheetFunction.EDate(mymin, j - 2))
          Next
     Next
     a = Application.Index(dict.items, 0, 0)
     With Range("G2").ListObject
         If .ListRows.Count Then .DataBodyRange.Delete
  .ListRows.Add.Range.Range("A1").Resize(dict.Count, 2).Value = Application.Index(dict.items, 0, 0)
          .Range.EntireColumn.AutoFit
     End With

     MsgBox "done in " & Format(Timer - t, "0.0s")
End Sub

james.xlsb
ABCDEFGHIJKLMN
1NameMonthnamebitwisenamemissing monthmonthMissing persons
2Rahulaug-21Rahul111010000000Rahulnov-21aug-215
3Rahulsep-21Atul000100000000Rahuljan-22sep-212
4Rahulokt-21H111010111101Rahulfeb-22okt-212
5Atulnov-21E011111110111Rahulmrt-22nov-213
6Rahuldec-21C111110000111Rahulapr-22dec-212
7Fsep-21F111111010111Rahulmei-22jan-227
8Gfeb-22J011010110111Rahuljun-22feb-224
9Kjun-22B000111111011Rahuljul-22mrt-225
10Gapr-22I111111111101Atulaug-21apr-227
11Eapr-22A111111111111Atulsep-21mei-223
12Ejan-22K111101100111Atulokt-21jun-224
13Ffeb-22G111110111110Atuldec-21jul-223
14Kaug-21D011110101111Atuljan-22
15Daug-21Atulfeb-22
16Fjul-22Atulmrt-22
17Kokt-21Atulapr-22
18Jsep-21Atulmei-22
19Gsep-21Atuljun-22
20Kokt-21Atuljul-22
james
Cell Formulas
RangeFormula
A7:A20A7=CHAR(RANDBETWEEN(65,75))
B7:B20B7=DATE(2021,7+RANDBETWEEN(1,12),1)
 
Upvote 0
Column A:B random names and months
Tbl_Bitwise (Column D:E) = all the names, 0=absent,1=present
Tbl_Missing (Columns F:G) = persons missing in a month
Pivottable = summary, number of persons missing per month
VBA Code:
Sub test()
     t = Timer
     Set dict = CreateObject("scripting.dictionary")
     dict.CompareMode = vbTextCompare

     a = Sheets("james").Range("A1").CurrentRegion.Value2       'read to an array
     mymin = Application.Min(Application.Index(a, 0, 2))        'smallest
     mymax = Application.Max(Application.Index(a, 0, 2))        'greatest
     Delta = WorksheetFunction.Round((mymax - mymin) / 30.5, 0) + 1     'number of months
     s0 = "'" & WorksheetFunction.Rept("0", Delta)              'startstring

     For i = 2 To UBound(a)
          If Not dict.exists(a(i, 1)) Then dict.Add a(i, 1), Array(a(i, 1), s0)     'does name already exist in dict, if not add
          it = dict(a(i, 1))                                    'item for that name
          j = WorksheetFunction.Round((a(i, 2) - mymin) / 30.5, 0) + 2     ' that month is character j in the string
          it(1) = Left(it(1), j - 1) & "1" & Mid(it(1), j + 1)  'replace that char with a "1"
          dict(a(i, 1)) = it                                    'write back to dict
     Next

     a = Application.Index(dict.items, 0, 0)
     With Range("D2").ListObject
          If .ListRows.Count Then .DataBodyRange.Delete
          .ListRows.Add.Range.Range("A1").Resize(dict.Count, 2).Value = Application.Index(dict.items, 0, 0)
          .Range.EntireColumn.AutoFit
     End With

     dict.RemoveAll
     For i = 1 To UBound(a)
          For j = 1 To Len(a(i, 2))
               If Mid(a(i, 2), j, 1) = "0" Then dict.Add dict.Count, Array(a(i, 1), WorksheetFunction.EDate(mymin, j - 2))
          Next
     Next
     a = Application.Index(dict.items, 0, 0)
     With Range("G2").ListObject
         If .ListRows.Count Then .DataBodyRange.Delete
  .ListRows.Add.Range.Range("A1").Resize(dict.Count, 2).Value = Application.Index(dict.items, 0, 0)
          .Range.EntireColumn.AutoFit
     End With

     MsgBox "done in " & Format(Timer - t, "0.0s")
End Sub

james.xlsb
ABCDEFGHIJKLMN
1NameMonthnamebitwisenamemissing monthmonthMissing persons
2Rahulaug-21Rahul111010000000Rahulnov-21aug-215
3Rahulsep-21Atul000100000000Rahuljan-22sep-212
4Rahulokt-21H111010111101Rahulfeb-22okt-212
5Atulnov-21E011111110111Rahulmrt-22nov-213
6Rahuldec-21C111110000111Rahulapr-22dec-212
7Fsep-21F111111010111Rahulmei-22jan-227
8Gfeb-22J011010110111Rahuljun-22feb-224
9Kjun-22B000111111011Rahuljul-22mrt-225
10Gapr-22I111111111101Atulaug-21apr-227
11Eapr-22A111111111111Atulsep-21mei-223
12Ejan-22K111101100111Atulokt-21jun-224
13Ffeb-22G111110111110Atuldec-21jul-223
14Kaug-21D011110101111Atuljan-22
15Daug-21Atulfeb-22
16Fjul-22Atulmrt-22
17Kokt-21Atulapr-22
18Jsep-21Atulmei-22
19Gsep-21Atuljun-22
20Kokt-21Atuljul-22
james
Cell Formulas
RangeFormula
A7:A20A7=CHAR(RANDBETWEEN(65,75))
B7:B20B7=DATE(2021,7+RANDBETWEEN(1,12),1)
I don’t think u understood my question
Why H is appearing when it’s not in the original list??
 
Upvote 0

Forum statistics

Threads
1,214,940
Messages
6,122,361
Members
449,080
Latest member
Armadillos

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