How to restart numbering when value changes in Excel?
To number rows or columns in Excel can be quite quick and easy. But do you know how to automatically restart numbering when a different value is entered in a column, and continue when there are repeated values as shown below? Please follow the instructions to get the job done.
Separate serial numbers for different values in another column in Excel
Let's say you have a list of values, and there are serial numbers assigned to the values as shown below. To separate serial numbers for different values in the list, please do as follows.
1. Enter the following formula in the cell A2:
=COUNTIF($B$2:$B2,B2)
Note: In the formula, B2 is the top cell of the value list. You should leave the dollar signs ($) the way they are, since the dollar sign makes the row letter and column number right behind it absolute, so the row and column won’t adjust when you copy the formula to below cells.
2. Select the cell A2, drag the fill handle (the small square in the lower-right corner of the selected cell) down to apply the formula to the below cells.
3. If you need to make the serial number and its corresponding value in one cell, you can use the formula below in the cell C2. After entering the formula, drag the fill handle down to the cells below.
=CONCATENATE(A2," ",B2)
Note: In the formula, A2 is the top cell of the serial number, and B2 is the top cell of the value list. " " is a space between A2 and B2. And you will get “1 A” as a result as shown below. You can change the snippet " " to other values such as ". " to get “1. A”.
4. Before you delete the column A and B, please convert the formulas in column C to text values so that you won’t get errors: Copy the column C2:C9, and then right click on a cell (say, cell C2) and select the Values button under Paste Options on the drop-down menu as shown below.
Alternatively, you can use Kutools for Excel’s To Actual feature to convert the formulas in C2:C9 to text directly by selecting the range and then click on the To Actual button on the Kutools tab.
Note: If you find the above two steps (step 3 and 4) are a bit annoying, please use Kutools for Excel's Combine rows, columns, or cells without losing data feature: Select the range A2:B9, then on Kutools tab, select Merge & Split > Combine rows, columns, or cells without losing data. See screenshot:
Related articles
How To Assign Serial Number To Duplicate Or Unique Values In Excel?
If you have a list of values which contains some duplicates, is it possible for us to assign sequential number to the duplicate or unique values? It means giving a sequential order for the duplicate values or unique values as following screenshot shown. This article, I will talk about some simple formulas to help you solving this task in Excel.
Best Office Productivity Tools
Supercharge Your Excel Skills with Kutools for Excel, and Experience Efficiency Like Never Before. Kutools for Excel Offers Over 300 Advanced Features to Boost Productivity and Save Time. Click Here to Get The Feature You Need The Most...
Office Tab Brings Tabbed interface to Office, and Make Your Work Much Easier
- Enable tabbed editing and reading in Word, Excel, PowerPoint, Publisher, Access, Visio and Project.
- Open and create multiple documents in new tabs of the same window, rather than in new windows.
- Increases your productivity by 50%, and reduces hundreds of mouse clicks for you every day!