VBA: Count the number of times a value appears in a column

sr1111

New Member
Joined
Sep 2, 2022
Messages
46
Office Version
  1. 2013
  2. 2011
  3. 2010
  4. 2007
Platform
  1. Windows
VBA: Count the number of times a value appears in a column
I am looking for help in VBA to achieve this. Some rows may have missing data in input sheet.

abc.xlsm
AB
1IDCount number of times a value appears
2ID1apple, bananna,apple
3ID2Orange, Apple
4ID3Grapes, grapes
5ID4@#$% apple ^&*()_bananna
6ID5apple
7ID6orange, Apple, orange
Input1


abc.xlsm
ABC
1ItemTotal Item countID
2Apple2ID2
3apple4ID1, ID5
4bananna2ID1, ID4!@#$% apple ^&*()_
5Orange1ID2
6orange2ID6
7grapes1ID3
Output1


abc.xlsm
ABC
1ItemTotal Item countID
2Apple6ID2, ID1, ID5
3bananna2ID1, ID4!@#$% apple ^&*()_
4Orange3ID2, ID6
5grapes1ID3
Output2
 

Excel Facts

Is there a shortcut key for strikethrough?
Ctrl+S is used for Save. Ctrl+5 is used for Strikethrough. Why Ctrl+5? When you use hashmarks to count |||| is 4, strike through to mean 5.

Forum statistics

Threads
1,214,626
Messages
6,120,602
Members
448,974
Latest member
ChristineC

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