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

Lock one reference in a formula
Need 1 part of a formula to always point to the same range? use $ signs: $V$2:$Z$99 will always point to V2:Z99, even after copying

Forum statistics

Threads
1,223,911
Messages
6,175,324
Members
452,635
Latest member
laura12345

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