Auto numbering dymanic row

trduy1908

New Member
Joined
Nov 29, 2023
Messages
7
Office Version
  1. 365
Platform
  1. Windows
Please help,

I want to get number in dynamic row.
Example: in column C, auto numbering based on value of B, if (B:B) have line is blank then, next line auto numbering start = 1
ABC
row 1Test
row 2Test1
row 3Test2
row 4Test
row 5Test1
row 6test2
row 7Test3
 

Excel Facts

How can you turn a range sideways?
Copy the range. Select a blank cell. Right-click, Paste Special, then choose Transpose.
If the first row is actually row 1 in Excel, place this formula in cell C1:
Excel Formula:
=IF(B1="","",1)

Put this formula in cell C2 and copy down for all remaining rows:
Excel Formula:
=IF(B2="","",IF(B1="",1,C1+1))
 
Upvote 0
Solution
If the first row is actually row 1 in Excel, place this formula in cell C1:
Excel Formula:
=IF(B1="","",1)

Put this formula in cell C2 and copy down for all remaining rows:
Excel Formula:
=IF(B2="","",IF(B1="",1,C1+1))
I save my life, thanks a lot. Wish you good health and success. Thanks!
 
Upvote 0
Another option.

Book3
ABC
1Test 
2Test1
3Test2
4Test
5Test1
6test2
7Test3
Sheet13
Cell Formulas
RangeFormula
C1:C7C1=LET(s,SCAN(0,B1:B7,LAMBDA(a,b,IF(ISBLANK(b),0,a+1))),IF(s=0,"",s))
Dynamic array formulas.
 
Upvote 0
You are welcome.
Glad we were able to help!
 
Upvote 0
I save my life, thanks a lot. Wish you good health and success. Thanks!
The marked solution has been changed accordingly. In your future questions, please mark the post as the solution that actually answered your question, instead of your feedback message as it will help future readers. No further action is required for this thread.
 
Upvote 0

Forum statistics

Threads
1,215,097
Messages
6,123,077
Members
449,094
Latest member
mystic19

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