Count month with the most occurrences

Maurizio

Well-known Member
Joined
Oct 15, 2002
Messages
680
Office Version
  1. 2007
Platform
  1. Windows
Hi all,
I have this DB with dates as european format "dd/mm/yy":
31/03/20
23/04/20
17/04/20
23/04/20
24/04/20
22/02/20
23/04/20
23/04/20
... [empty cell]
22/04/20
22/04/20
24/04/20
... [empty cell]
24/04/20
23/04/20
23/04/20
28/01/20

I need a vba solution to give me --> 4
[ossia April the month with the most occurrences]

Tia. Maurizo
 

Some videos you may like

Excel Facts

Control Word Wrap
Press Alt+Enter to move to a new row in a cell. Lets you control where the words wrap.

BobUmlas

Well-known Member
Joined
Mar 14, 2002
Messages
1,181
Formula solution:
Define the cells as Rg, then this formula does the job:
=MATCH(MAX(FREQUENCY(MONTH(rg),ROW(1:12))),FREQUENCY(MONTH(rg),ROW(1:12)),0)

If you don't have Microsoft 365, you will need to ctrl/shift/enter that formula
 

Fluff

MrExcel MVP, Moderator
Joined
Jun 12, 2014
Messages
55,460
Office Version
  1. 365
Platform
  1. Windows
You don't need a macro, it can be done with a simple formula
+Fluff New.xlsm
KL
1
231/03/20204
323/04/2020
417/04/2020
523/04/2020
624/04/2020
722/02/2020
823/04/2020
923/04/2020
10
1122/04/2020
1222/04/2020
1324/04/2020
14
1524/04/2020
1623/04/2020
1723/04/2020
1828/01/2020
Sheetref
Cell Formulas
RangeFormula
L2L2=MODE(IF(K2:K100<>"",MONTH(K2:K100)))
Press CTRL+SHIFT+ENTER to enter array formulas.
 

Maurizio

Well-known Member
Joined
Oct 15, 2002
Messages
680
Office Version
  1. 2007
Platform
  1. Windows
Hi Fluff and BobUmlas,
many Thnks
 

Fluff

MrExcel MVP, Moderator
Joined
Jun 12, 2014
Messages
55,460
Office Version
  1. 365
Platform
  1. Windows
Glad we could help & thanks for the feedback
 

Watch MrExcel Video

Forum statistics

Threads
1,127,407
Messages
5,624,587
Members
416,036
Latest member
eloisa manzanarez

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
Top