Auto generate serial number in Excel: VBA, formula

Auto generate serial number in Excel: VBA, formula

Microsoft's office software Excel is a powerful tool to perform day-to-day activities with, like simple arithmetic, sorting, filtering, arranging and summarising data in various formats. Excel has a huge collection of formulas which can be used independently or in conjunction with each other to achieve desired results. This article will show you how to create serial numbers.

Logical formulas can be combined with text or numeric functions to segregate data in any desired way, for example, to exclude rows which do not have serial numbers. The same formula can be applied to multiple cells by simply dragging it to them, or by using paste-special with formulas and number formats.

To create serial numbers in Excel:

Assumptions:

  • 1. You want series to appear in Column A
  • 2. If a row has a data, then column B of that row would have data
  • 3. Row 1 is a header

Write in Cell A2

=IF($B2="","",COUNTA($B$2:$B2)) 

Drag this formula down

any more excel questions? check out our forum!

Excel