Share via

Count macro

Anonymous
2019-12-03T20:34:18+00:00

I need a "count macro" that will count each digits from my data, example

1 1 5                      0_11

7 3 2                    1_7

0 2 2                      2_7

6 3 2                   3_7

8 5 0                      4_5

3 9 7                    5_8

7 3 5                      6_3

9 1 0                      7_5

4 5 4                      8_2

3 0 1                      9_5

1 3 5

6 7 4

9 5 2

5 4 0

0 0 1

4 8 9

0 3 2

0 9 6

1 7 0

2 5 0

As you can see, the data is three digits long and twenty rows deep, but they very, sometime there are four digits or five, and the rows are sometime twenty, fifty or sixty long. In this example I have manually counted each digit in the data, there are 11 zeros, 7 ones, and 7 two's and so on. I need a macro that will count each digit in the data and put the results in column D or where ever on the same page. I just want to put the data in and the macro will automatically count each digit whether the rows in the data is 3 rows or 100.

Microsoft 365 and Office | Excel | For home | Windows

Locked Question. This question was migrated from the Microsoft Support Community. You can vote on whether it's helpful, but you can't add comments or replies or follow the question.

0 comments No comments

Answer accepted by question author

HansV 462.6K Reputation points
2019-12-03T21:19:42+00:00

Enter the digits 0 to 9 in a column, for example in D1:D10.

Enter the following formula in E1:

=SUMPRODUCT(LEN($A$1:$A$200)-LEN(SUBSTITUTE($A$1:$A$200,D1,"")))

It doesn't matter if column A has fewer than 200 entries, but if you expect more, change the formula accordingly.

Fill or copy down from E1 to E10.

Was this answer helpful?

2 people found this answer helpful.
0 comments No comments

1 additional answer

Sort by: Most helpful
  1. Anonymous
    2019-12-04T11:00:41+00:00

    Boom, right on, thanks, you hit the Nile on the head.

    Was this answer helpful?

    0 comments No comments