close

I am trying to total the occurrences of comma delimited numbers in a column.
See original post below:

gt;gt;I have a column which has a variable number of comma delimited values in
gt;gt;the range of 11 to 56 in each cell. Is there a method or macro to count
gt;gt;the
gt;gt;occurrences of each number in the column and either output the results to
gt;gt;a
gt;gt;file or another worksheet or the same worksheet?
gt;gt;
gt;gt; Example:
gt;gt;A1: 23,40,52,31,
gt;gt;A2: 42,14,
gt;gt;A3: 56,
gt;gt;A4: 27,43,19,
gt;gt; etc.
gt;gt;
gt;gt; What I am doing now is coping the column to Word, closing the margins to
gt;gt; 3
gt;gt; characters, coping that result to an clean worksheet, sorting the new
gt;gt; column ascending and printing the results and counting the occurrences
gt;gt; manually. This is getting tedious as the column grows in length.
gt;gt;
gt;gt; Can anyone help me or point me to a solution?
gt;gt;

Biff replied with a formula using SUMPRODUCT. See his reply below:

gt; Hi!
gt;
gt; Assume the numbers are in the range A1:A10.
gt;
gt; In C1 enter 11.
gt;
gt; In D1 enter this formula:
gt;
gt; =SUMPRODUCT(LEN(A$1:A$10)-LEN(SUBSTITUTE(A$1:A$10,C1,quot;quot;)))/2
gt;
gt; Select both C1 and D1 and drag copy down to row 46.
gt;
gt; Biff

For the life of me I cannot get this to work. When I enter his formula
(exactly as written in a test worksheet), I get an error #NAME?

Can anyone please help.

Thanks a million,

Glynn .. gfurr1 at nc dot rr dot com
Hi!

The only reason that #NAME? should be the result is if one of the functions
was misspelled?

Here's a sample file that demonstrates this:

count_instances.xls 14kb

s54.yousendit.com/d.aspx?id=3...31HIB756ZT0TN5

Biff

quot;Glynn Furrquot; gt; wrote in message
...
gt;I am trying to total the occurrences of comma delimited numbers in a
gt;column. See original post below:
gt;
gt;gt;gt;I have a column which has a variable number of comma delimited values in
gt;gt;gt;the range of 11 to 56 in each cell. Is there a method or macro to count
gt;gt;gt;the
gt;gt;gt;occurrences of each number in the column and either output the results to
gt;gt;gt;a
gt;gt;gt;file or another worksheet or the same worksheet?
gt;gt;gt;
gt;gt;gt; Example:
gt;gt;gt;A1: 23,40,52,31,
gt;gt;gt;A2: 42,14,
gt;gt;gt;A3: 56,
gt;gt;gt;A4: 27,43,19,
gt;gt;gt; etc.
gt;gt;gt;
gt;gt;gt; What I am doing now is coping the column to Word, closing the margins to
gt;gt;gt; 3
gt;gt;gt; characters, coping that result to an clean worksheet, sorting the new
gt;gt;gt; column ascending and printing the results and counting the occurrences
gt;gt;gt; manually. This is getting tedious as the column grows in length.
gt;gt;gt;
gt;gt;gt; Can anyone help me or point me to a solution?
gt;gt;gt;
gt;
gt; Biff replied with a formula using SUMPRODUCT. See his reply below:
gt;
gt;gt; Hi!
gt;gt;
gt;gt; Assume the numbers are in the range A1:A10.
gt;gt;
gt;gt; In C1 enter 11.
gt;gt;
gt;gt; In D1 enter this formula:
gt;gt;
gt;gt; =SUMPRODUCT(LEN(A$1:A$10)-LEN(SUBSTITUTE(A$1:A$10,C1,quot;quot;)))/2
gt;gt;
gt;gt; Select both C1 and D1 and drag copy down to row 46.
gt;gt;
gt;gt; Biff
gt;
gt; For the life of me I cannot get this to work. When I enter his formula
gt; (exactly as written in a test worksheet), I get an error #NAME?
gt;
gt; Can anyone please help.
gt;
gt; Thanks a million,
gt;
gt; Glynn .. gfurr1 at nc dot rr dot com
gt;
Hi,

Is Sumproduct() really needed ...
Here is the formula I am using :

=LEN(A1)-LEN(SUBSTITUTE(A1,quot;,quot;,quot;quot;))

HTH
Cheers
CarimI think you may have misunderstood what the OP wants to do.

Count the instances a number from 11 to 56 appears in a range of cells.

gt; Is Sumproduct() really needed ...

You could use SUM and array enter the formula.

Biff

quot;Carimquot; gt; wrote in message oups.com...
gt; Hi,
gt;
gt; Is Sumproduct() really needed ...
gt; Here is the formula I am using :
gt;
gt; =LEN(A1)-LEN(SUBSTITUTE(A1,quot;,quot;,quot;quot;))
gt;
gt; HTH
gt; Cheers
gt; Carim
gt;
Or use
Data gt; Text to Columns gt; Delimited gt; Comma
Add your own row and column headers.
Then use
Data gt; Pivot Table gt; Multiple Consolidatation Ranges.

In Pivot Table Wizard gt; Layout,
drag the Row and Column button off the diagram and
place the Value button where the Row button used to be.
Again, drag the Value button to the Data area and right click it
to select Count of Value.
In Pivot Table Wizard gt; Options gt; Uncheck Grand Totals

arrow
arrow
    全站熱搜
    創作者介紹
    創作者 software 的頭像
    software

    software

    software 發表在 痞客邦 留言(0) 人氣()