We help IT Professionals succeed at work.

Check out our new AWS podcast with Certified Expert, Phil Phillips! Listen to "How to Execute a Seamless AWS Migration" on EE or on your favorite podcast platform. Listen Now

x

MS Excel assing serial number based on the cells matching the contents

Medium Priority
1,761 Views
Last Modified: 2012-05-11
I don't know much of MS-Excel. I have an .xls file of 3000 rows/columns. I have to assign serial numbers starting from 0 based on the cells which has same contents. I can do entering 0 in one cell and use drag and drop but doing this for huge file takes much time. The file contents are as below:

A1                B2

Dentist           0
Dentist           1
Dentist           2
Dentist           4
Tax Return        0
Tax Return        1
Tax Return        2
Tax Return        3
Tax Return        4
Tax Return        5
Finance           0
Insurance         0
Insurance         1
something         0
--------          1
--------

Open in new window


In the column B2 I manually did drag and drop. Anybody has any trick so that I can do it for the entire file with a single shot or with less steps?
Comment
Watch Question

Commented:
There are several options.
If you know how many cells you want to go, you can use the Fill Series wizard.

In Excel 2007/2010, go to the Home tab, Editing group, Fill item (box with blue arrow pointing down) and select Series...
(Before you do this, go to the cell where you want it to start, and put a starting number.)
From there, select:
Series in "Columns"
Type "Linear"
Step Value "1"
Stop Value "5000" (or whereever it will end.)
Commented:
Unlock this solution with a free trial preview.
(No credit card required)
Get Preview
Commented:
Unlock this solution with a free trial preview.
(No credit card required)
Get Preview
Michael FowlerSolutions Consultant
Commented:
Unlock this solution with a free trial preview.
(No credit card required)
Get Preview
CERTIFIED EXPERT
Commented:
Unlock this solution with a free trial preview.
(No credit card required)
Get Preview
CERTIFIED EXPERT

Commented:
The formula I posted above will work even when your values in column A are not sorted.

Author

Commented:
Probably I confused many between count and serial number. And the macros will always do in one shot but I'm failing to use them which are posted here as they are giving some errors when I try to run but are useful. The count is also useful for me. Thank you all!

Author

Commented:
Probably I didn't assign points proper having got the solution though but it's my sole responsibility assigning points equally as much as possible. Everyone's solutions is correct but I couldn't make use of it properly(macros and count). Excuse me!. Thanks a lot!
Unlock the solution to this question.
Thanks for using Experts Exchange.

Please provide your email to receive a free trial preview!

*This site is protected by reCAPTCHA and the Google Privacy Policy and Terms of Service apply.

OR

Please enter a first name

Please enter a last name

8+ characters (letters, numbers, and a symbol)

By clicking, you agree to the Terms of Use and Privacy Policy.