VBA help to select value with most occurences

ssmith001

New Member
Joined
Mar 5, 2018
Messages
3
I am looking for some assistance with VBA code for Excel to help me find the value of a range of cells that has the greatest number of occurrences of a number. Not sure I explained that correctly so here's the data in column A


734
734
827
277
198
124
350
182
734
734
837
199
201
734

What I want to come out of this is a variable with the number 734 in it, since that number occurs the most.
 

Excel Facts

Pivot Table Drill Down
Double-click any number in a pivot table to create a new report showing all detail rows that make up that number
Thanks Rick. I'm not sure how to use this function in VBA. Can you explain?
Sorry, I overlooked the VBA part of your question. Try this...

MostFrequentNumber = WorksheetFunction.Mode(Range("A1:A14"))
 
Upvote 0

Forum statistics

Threads
1,215,492
Messages
6,125,116
Members
449,206
Latest member
burgsrus

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