Formula to Merge identical text in different Cells in the same Column and give the Total Count for the Merged Text

DataQuestioner

Board Regular
Joined
Sep 12, 2013
Messages
115
ABCD
ORIGINAL
TEXT
ORIGINAL
COUNT
ALPHABETICAL
RESULT
NEW
COUNT
1TEST2TEST4
2TESTER3TESTED5
3TESTING1TESTER6
4TEST1TESTING3
5TESTED4
6TESTED1
7TEST1
8TESTING2
9TESTER3
10
11COUNT =18COUNT =18

<tbody>
</tbody>


Using the sample table above, how do I get the text in Column A1:A9, with its associated counts in Column B1:B9, to be merged into unique occurrences of each word, and listed in alphabetical order in Column C, with their new merged count listed in Column D?

NOTE: Obviously, as a cross check, the Total Count in Cells B11 and D11 must be identical.

Thanks.
 

Excel Facts

What do {} around a formula in the formula bar mean?
{Formula} means the formula was entered using Ctrl+Shift+Enter signifying an old-style array formula.
Use SUMIF


Excel 2010
ABCD
1ORIGINALORIGINALALPHABETICALNEW
2TEXTCOUNTRESULTCOUNT
3TEST2TEST4
4TESTER3TESTED5
5TESTING1TESTER6
6TEST1TESTING3
7TESTED4
8TESTED1
9TEST1
10TESTING2
11TESTER3
12
13COUNT =18COUNT =18
Sheet5
Cell Formulas
RangeFormula
D3=SUMIF($A$3:$A$11,$C3,$B$3:$B$11)
D4=SUMIF($A$3:$A$11,$C4,$B$3:$B$11)
D5=SUMIF($A$3:$A$11,$C5,$B$3:$B$11)
D6=SUMIF($A$3:$A$11,$C6,$B$3:$B$11)
D13=SUM(D3:D12)
B13=SUM(B3:B12)
 
Upvote 0
Shyy,
Thanks for your D3 to D6 formulas.

I can understand how the results in cells D3 to D6 are generated.
How does your formula arrange cells C3 to C6 in alphabetical order? I cant see that.

Remember, the formula has to create the contents for BOTH the 'C' and 'D' Columns.
 
Upvote 0
Didn't catch that part, I believe you will have to use a macro. You can use the macro recorder and record yourself alphabetizing the cell C2. But inset a blank column between B and C or your will also sort Columns A and B.

For Column C use this instead since you wanted formulas.

Excel 2010
ABCD
1TEXTCOUNTRESULTCOUNT
2TEST2TEST4
3TESTER3TESTER6
4TESTING1TESTING3
5TEST1TESTED5
6TESTED4
7TESTED1
8TEST1
9TESTING2
10TESTER3
11
12COUNT =18COUNT =18

<colgroup><col style="width: 25pxpx"><col><col><col><col></colgroup><thead>
</thead><tbody>
</tbody>
Sheet1

Worksheet Formulas
CellFormula
C2=IFERROR(INDEX($A$2:$A$10,MATCH(0,INDEX(COUNTIF($C$1:$C1,$A$2:$A$10),,),0)),"")
D2=SUMIF($A$2:$A$10,$C2,$B$2:$B$10)
C3=IFERROR(INDEX($A$2:$A$10,MATCH(0,INDEX(COUNTIF($C$1:$C2,$A$2:$A$10),,),0)),"")
D3=SUMIF($A$2:$A$10,$C3,$B$2:$B$10)
C4=IFERROR(INDEX($A$2:$A$10,MATCH(0,INDEX(COUNTIF($C$1:$C3,$A$2:$A$10),,),0)),"")
D4=SUMIF($A$2:$A$10,$C4,$B$2:$B$10)
C5=IFERROR(INDEX($A$2:$A$10,MATCH(0,INDEX(COUNTIF($C$1:$C4,$A$2:$A$10),,),0)),"")
D5=SUMIF($A$2:$A$10,$C5,$B$2:$B$10)
C6=IFERROR(INDEX($A$2:$A$10,MATCH(0,INDEX(COUNTIF($C$1:$C5,$A$2:$A$10),,),0)),"")
C7=IFERROR(INDEX($A$2:$A$10,MATCH(0,INDEX(COUNTIF($C$1:$C6,$A$2:$A$10),,),0)),"")
C8=IFERROR(INDEX($A$2:$A$10,MATCH(0,INDEX(COUNTIF($C$1:$C7,$A$2:$A$10),,),0)),"")
C9=IFERROR(INDEX($A$2:$A$10,MATCH(0,INDEX(COUNTIF($C$1:$C8,$A$2:$A$10),,),0)),"")
C10=IFERROR(INDEX($A$2:$A$10,MATCH(0,INDEX(COUNTIF($C$1:$C9,$A$2:$A$10),,),0)),"")
B12=SUM(B2:B11)
D12=SUM(D2:D11)

<thead>
</thead><tbody>
</tbody>

<tbody>
</tbody>
 
Last edited:
Upvote 0
Shyy,
Thanks for your latest code.

If my 'A' + 'B' Columns have 1000's of cells with single word text and numerals, respectively, I'm not sure that I would want to insert the "=IFERROR..." function that many times - is there not an Array Formula solution for this problem?
 
Upvote 0
Not sure what you mean,

add in the IFERROR only because cells return #N/A. Whether its a single word or a number, it still works. Unless you have another example to illustrate what you mean.

Shyy,
Thanks for your latest code.

If my 'A' + 'B' Columns have 1000's of cells with single word text and numerals, respectively, I'm not sure that I would want to insert the "=IFERROR..." function that many times - is there not an Array Formula solution for this problem?
 
Upvote 0
Your formulae in post #4 require me to add the "IFERROR..." to each 'D' Column cell - Yes?

If I have 1000's of cells to be completed, based on 1000's of text+number counts in 'A' + 'B' Columns, then am I supposed to add your "IFERROR..." formula to each and every 'D' Column cell 1000's of times? That's too time consuming!
 
Upvote 0
Sorry, I meant to say do you want me to add the "SUMIF..." formula to every one of the 1000's of 'D' Column cells?
 
Upvote 0
Yes you have to SUM up all the numbers in column C.

Don't know if this will make any difference when it comes to calculation.

=IF(ISBLANK(C2),"",SUMIF($A$2:$A$10,$C2,$B$2:$B$10)
 
Upvote 0

Forum statistics

Threads
1,215,064
Messages
6,122,939
Members
449,094
Latest member
teemeren

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