Excel Table Number Incrementer

legalhustler

Well-known Member
Joined
Jun 5, 2014
Messages
1,214
Office Version
  1. 365
Platform
  1. Windows
I have a Excel table. A1 contains the header. From A2:A10 I have the following formula Row()-1 to give me the sequential number increment (1, 2, 3, 4 etc). However if I add row above A1 the numbers mess up (2, 3, 4, 5). I need a dynamic formula that takes into consideration if the rows above contain text or is blank then the number increment should display correctly. Can someone help.

Thanks!
 

Excel Facts

Format cells as date
Select range and press Ctrl+Shift+3 to format cells as date. (Shift 3 is the # sign which sort of looks like a small calendar).
i'm not fully understanding. if you add a row at the top, you still want the numbers to say 1, 2,3, 4, 5... i don't get the point about "if the rows above contain text or is blank then the number increment should display correctly". 1, 2, 3, "ABC", 4, 5? you can do =Max(indirect("A$1:A"&Row()-1))+1 maybe?


 
Upvote 0
i'm not fully understanding. if you add a row at the top, you still want the numbers to say 1, 2,3, 4, 5... i don't get the point about "if the rows above contain text or is blank then the number increment should display correctly". 1, 2, 3, "ABC", 4, 5? you can do =Max(indirect("A$1:A"&Row()-1))+1 maybe?



Your formula works. If I add rows above my table then the number increment (1, 2, 3, etc) does not change. Is there a way to avoid using volatile functions like INDIRECT?
 
Last edited:
Upvote 0
A2: =ROWS(A$2:A2) copy down

that doesn't work because when you insert a row the numbers change. i'm assuming what he wants to do is have like subtotal or category header in between the numbers.

Legalhustler, maybe as easy as hardcoding A1 (or where ever the first data is) as 1, then in A2 =A1+1 and drag it down? this way you insert a row and the formula will still reference the old cell.
 
Upvote 0

Forum statistics

Threads
1,224,823
Messages
6,181,173
Members
453,021
Latest member
Justyna P

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