Skip to main content

How to create number sequence based on criteria in Excel?

In Excel, it may be a common task for you to make a number sequence for a list of cells. But, the task will get a little complicated if you need to create number sequence based on criteria. in this article, I will talk about some useful formulas for creating a number sequence based on criteria in Excel.

Create number sequence based on duplicate entries with COUNTIF function

Create number sequence based on criteria with COUNTIF and IF functions


Create number sequence based on duplicate entries with COUNTIF function

For example, I want to insert serial numbers based on the country column. That means, if there are multiple entries of the same country, I will order them accordingly as below screenshot shown:

To create serial numbers based on the duplicate values in another column, the COUNTIF function can do you a favor:

Step1: Enter the below formula into a blank cell where you want to insert the sequence number:

=COUNTIF(B$2:B2,B2)

Step2: Then, drag the fill handle down to fill this formula to other cells, see screenshot:


Create number sequence based on criteria with COUNTIF and IF functions

If you want to create a number sequence based on a specific value in another column, for example, to create a list of serial numbers based on the specific text “Total” in column A: If a Total is displayed, skip that row and move to the next row continuing numbering.

To create this type of sequence, please use the following formula:

Step1: Enter the number 1 into the first cell where you want to insert the number sequence, see screenshot:

Step2: In the second cell, please enter either of the following formulas according to your Excel version:

=IF(@$A$2:$A$14="Total","",COUNTIF($C$2:C2,">0")+1)       (Excel 365)
=IF($A$2:$A$14="Total","",COUNTIF($C$2:C2,">0")+1)          (Other Excel versions)

Note: In the above formulas, $A$2:$A$14="Total" is the range that includes the criteria you want to insert number sequence based on, C2 is the cell with the number 1 you entered in step1, please change them to your actual cell references.

Step3: Then, drag the fill handle to cell C14 for filling the range of cells with the serial numbers. See screenshot:

Best Office Productivity Tools

🤖 Kutools AI Aide: Revolutionize data analysis based on: Intelligent Execution   |  Generate Code  |  Create Custom Formulas  |  Analyze Data and Generate Charts  |  Invoke Kutools Functions
Popular Features: Find, Highlight or Identify Duplicates   |  Delete Blank Rows   |  Combine Columns or Cells without Losing Data   |   Round without Formula ...
Super Lookup: Multiple Criteria VLookup    Multiple Value VLookup  |   VLookup Across Multiple Sheets   |   Fuzzy Lookup ....
Advanced Drop-down List: Quickly Create Drop Down List   |  Dependent Drop Down List   |  Multi-select Drop Down List ....
Column Manager: Add a Specific Number of Columns  |  Move Columns  |  Toggle Visibility Status of Hidden Columns  |  Compare Ranges & Columns ...
Featured Features: Grid Focus   |  Design View   |   Big Formula Bar    Workbook & Sheet Manager   |  Resource Library (Auto Text)   |  Date Picker   |  Combine Worksheets   |  Encrypt/Decrypt Cells    Send Emails by List   |  Super Filter   |   Special Filter (filter bold/italic/strikethrough...) ...
Top 15 Toolsets12 Text Tools (Add Text, Remove Characters, ...)   |   50+ Chart Types (Gantt Chart, ...)   |   40+ Practical Formulas (Calculate age based on birthday, ...)   |   19 Insertion Tools (Insert QR Code, Insert Picture from Path, ...)   |   12 Conversion Tools (Numbers to Words, Currency Conversion, ...)   |   7 Merge & Split Tools (Advanced Combine Rows, Split Cells, ...)   |   ... and more

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...

Description


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!
Comments (0)
No ratings yet. Be the first to rate!
There are no comments posted here yet
Please leave your comments in English
Posting as Guest
×
Rate this post:
0   Characters
Suggested Locations