Sequential numbering of months without VBA

Kaarthuul

New Member
Joined
Mar 17, 2005
Messages
17
Office Version
  1. 365
Platform
  1. Windows
I have a spreadsheet I am working on and I have a list of months in one column. I need the next column to be the number of appearance of each month in the list (see attached).

Ideally I would love this to be one formula in B1 that does this dynamically, so that when the list grows/shrinks it adjusts to fit?

Thanks,

Clive
 

Attachments

  • Screenshot 2025-02-17 153618.jpg
    Screenshot 2025-02-17 153618.jpg
    25.4 KB · Views: 18
What version of Excel are you using?

I suggest that you update your Account details (or click your user name at the top right of the forum) so helpers always know what Excel version(s) & platform(s) you are using as the best solution often varies by version. (Don’t forget to scroll down & ‘Save’)
 
Upvote 0
What version of Excel are you using?

I suggest that you update your Account details (or click your user name at the top right of the forum) so helpers always know what Excel version(s) & platform(s) you are using as the best solution often varies by version. (Don’t forget to scroll down & ‘Save’)
Done
 
Upvote 0
Thanks for that. (y)
How about
Excel Formula:
=LET(h,TRIMRANGE(A2:A100),r,ROWS(h),MMULT((SEQUENCE(r)>=SEQUENCE(,r))*(h=TOROW(h)),SEQUENCE(r,,,0)))
 
Upvote 0
Solution
Here is a somewhat shorter formula that will also work...

=SCAN(1,A:.A,LAMBDA(a,x,COUNTIF(A1:x,x)))

If you are not starting at cell A1 (as your picture shows), then try something like this instead...

=SCAN(1,A2:.A999,LAMBDA(a,x,COUNTIF(A2:x,x)))

Note the dot after the first colon in each formula... it is the shortcut notation for TRIMRANGE downward.
 
Last edited:
Upvote 0
Or even shorter
Excel Formula:
=MAP(A:.A,LAMBDA(x,COUNTIF(A1:x,x)))
 
Upvote 0
and yet one more option with power query

Power Query:
let
    Source = Excel.CurrentWorkbook(){[Name="Table1"]}[Content],
    #"Grouped Rows" = Table.Group(Source, {"Column1"}, {{"Count", each _, type table [Column1=text]}}),
    #"Added Custom" = Table.AddColumn(#"Grouped Rows", "Custom", each Table.AddIndexColumn([Count],"Counts",1,1)),
    #"Removed Other Columns" = Table.SelectColumns(#"Added Custom",{"Custom"}),
    #"Expanded Custom" = Table.ExpandTableColumn(#"Removed Other Columns", "Custom", {"Column1", "Counts"}, {"Column1", "Counts"})
in
    #"Expanded Custom"
 
Upvote 0

Forum statistics

Threads
1,226,854
Messages
6,193,374
Members
453,792
Latest member
Vic001

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