Need a formula to sort/index/count - help!

cr2crf

New Member
Joined
Jun 19, 2013
Messages
40
I have a spreadsheet with names in column a. Many of the names are duplicates. What I am trying to do is find a way to sort them so that the names can be listed once with a corresponding number to the cell to the right telling me how many times the name is used.

Example:

Column A:
smith
jones
smith
smith
jones
jones
Williams
Barns
Smith
Williams

I want columns B and C to look like this:
smith 4
jones 3
williams 2
barns 1

Thanks
 

Excel Facts

How to total the visible cells?
From the first blank cell below a filtered data set, press Alt+=. Instead of SUM, you will get SUBTOTAL(9,)
Given in A1 of sheet 'cr2crf':
smithsmith4
jonesjones3
smithWilliams2
smithBarns1
jones
jones
Williams
Barns
smith
Williams

<tbody>
</tbody>

name range cr2cr =ROW('cr2crf '!$A$1:$A$1500)-ROW('cr2crf '!$A$1)+1 change range to fit your model
formula in B1 is =IFERROR(INDEX($A$1:$A$390,SMALL(IF(FREQUENCY(IF($A$1:$A$390<>"",MATCH("~"&$A$1:$A$390,$A$1:$A$390&"",0)),cr2cr),cr2cr),ROWS($B$1:B1))),"") Ctrl + Shift + Enter not just enter on a PC or Command + Return on a MAC.
formula in C1 is =IF(B1="","",COUNTIF($A$1:$A$1500,B1)) copied down till needed.

Would that be close to what you required?
 
Upvote 0
I refreshed before I posted my solution, but after posting I see Cyrilbrd had a post 9 minutes before me so I removed mine.
 
Last edited:
Upvote 0
Given in A1 of sheet 'cr2crf':
smithsmith4
jonesjones3
smithWilliams2
smithBarns1
jones
jones
Williams
Barns
smith
Williams

<tbody>
</tbody>

name range cr2cr =ROW('cr2crf '!$A$1:$A$1500)-ROW('cr2crf '!$A$1)+1 change range to fit your model
formula in B1 is =IFERROR(INDEX($A$1:$A$390,SMALL(IF(FREQUENCY(IF($A$1:$A$390<>"",MATCH("~"&$A$1:$A$390,$A$1:$A$390&"",0)),cr2cr),cr2cr),ROWS($B$1:B1))),"") Ctrl + Shift + Enter not just enter on a PC or Command + Return on a MAC.
formula in C1 is =IF(B1="","",COUNTIF($A$1:$A$1500,B1)) copied down till needed.

Would that be close to what you required?

I appreciate your work but Im new to this and don't quite know "range range cr2crf"
 
Upvote 0
I appreciate your work but Im new to this and don't quite know "range range cr2crf"
No worries.
Name Ranges are explained here: click on this link.
If you have difficulties just let us know.
In a nutshell:

  1. Choose Insert>Name>Define
  2. Type a name for the range, e.g. cr2cr instead of Namelist as seen in the picture
    Name01.gif

  3. In the Refers To box, enter an Offset formula that defines the range size, based on the number of items in the column, e.g.:
    =ROW('cr2crf '!$A$1:$A$1500)-ROW('cr2crf '!$A$1)+1 instead of =OFFSET(Sheet1!$A$1,0,0,COUNTA(Sheet1!$A:$A),1) as seen above...
  4. Click OK
 
Upvote 0

Forum statistics

Threads
1,214,945
Messages
6,122,397
Members
449,081
Latest member
JAMES KECULAH

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