Macro to capture/count data in a column

ctackett6407

Board Regular
Joined
Mar 18, 2018
Messages
64
Good Morning!

I'm tryig to figure out how to create macro that will review a column and list and count values in the field.

Example

The Column will hav "Unit" as defned by House, Apartment, Barn, whatever.

My goal is to try to run something that go through the column and capture all values of like names and count them.

Unit (Column Header)
House
Apartment
Apt
Hus
Barn
Brn
Blah
Blah
Blah

and the output would be

House 1
Apartment 1
Apt 1
Hus 1
Barn 1
Brn 1
Blah 3
 

Some videos you may like

Excel Facts

Save Often
If you start asking yourself if now is a good time to save your Excel workbook, the answer is Yes

jmacleary

Well-known Member
Joined
Oct 5, 2015
Messages
1,026
Office Version
  1. 365
  2. 2007
Platform
  1. Windows
Hi there.

It looks like a pivot table will do exactly what you want.

Just create a new pivot table, choose your range as the data source, and then drag the column header into the row labels area, and drag it again into the values area.

LMNOPQRS
13
14 Unit (Column Header) Row LabelsCount of Unit (Column Header)
15 House Apartment1
16 Apartment Apt1
17 Apt Barn1
18 Hus Blah3
19 Barn Brn1
20 Brn House1
21 Blah Hus1
22 Blah Grand Total9
23 Blah
24

<colgroup><col style="font-weight:bold; width:30px; "><col style="width:64px;"><col style="width:64px;"><col style="width:64px;"><col style="width:64px;"><col style="width:64px;"><col style="width:92px;"><col style="width:203px;"><col style="width:64px;"></colgroup><tbody>
</tbody>

You should get something like the above.
 
Last edited:

Watch MrExcel Video

Forum statistics

Threads
1,109,518
Messages
5,529,314
Members
409,862
Latest member
lbisacca
Top