How to assign a number value to text within worksheet

lizzae

New Member
Joined
May 15, 2009
Messages
12
I need to count the number of times a value appears in a row and assign a number that tells which occurence of the text it is.
For example

Name Address
Jim 123 Smith Street
Jane 123 Smith Street
Bob 543 Apple Street
Mary 543 Apple Street

I would like a way to insert a column that puts a 1 next to Jim and a 2 next to Jane, a 1 next to Bob and a 2 next to Mary and so on.
Ultimately, I want to sort the list and delete all the twos, thus deleting the duplicate address entry.
Thank you
 
Did you not see my formula?

=COUNTIF($B$2:B2,B2)

Put that in C2 and fill down. The first occurrence will show a 1, the second a 2, third a 3, etc.
 
Upvote 0

Excel Facts

Square and cube roots
The =SQRT(25) is a square root. For a cube root, use =125^(1/3). For a fourth root, use =625^(1/4).
Well the only other formula I can come up with would require you to sort the file so all address are next to each other then:

=IF(B2=B1,"DUPLICATE","")
 
Upvote 0
MVP -
I apologize, I did not see your formula!
It looks like it does exactly what I need.
I will try it out on my larger spreadsheet today and post a reply if it is a success!!
 
Upvote 0

Forum statistics

Threads
1,215,214
Messages
6,123,664
Members
449,114
Latest member
aides

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