Formula to number sequentially

Arts

Well-known Member
Joined
Sep 28, 2007
Messages
782
Office Version
  1. 365
  2. 2016
Platform
  1. Windows
Hi all

I have a list of items that needs numbering (goes down quite a way) but I can't seem to find a formula to number each item as there is a gap after each line.

example below (which I did manually for the first few) there is always number against text then a blank row then number... I tried a few ways using sequence and counta but cant seem to get it to number sequentially. I don't mind putting the formula in helper column and then pasting over if that makes it easier

Thanks as always

on excel 365



1 Text Text
2 Text Text
3 Text Text
4 Text Text
5 Text Text
6 Text Text
 

Excel Facts

Square and cube roots
The =SQRT(25) is a square root. For a cube root, use =125^(1/3). For a fourth root, use =625^(1/4).
Hello, maybe something like:

Excel Formula:
=DROP(IFNA(TOCOL(EXPAND(SEQUENCE(ROUND(ROWS(A1:A11)/2,0)),,2)),""),-1)
 
Upvote 0
Solution
Few options:
Book2
ABCD
1Option1Option2Header1Header2
211TextText
3 
422TextText
5 
633TextText
7 
844TextText
9 
1055TextText
11 
1266TextText
Sheet1
Cell Formulas
RangeFormula
A2:A12A2=IF(C2:C12="","",SEQUENCE(ROWS(C2:C12),,,1/2))
B2:B12B2=IF(C2="","",COUNTA($C$2:C2))
Dynamic array formulas.
 
Upvote 0
You can shorten that slightly like
Excel Formula:
=DROP(TOCOL(EXPAND(SEQUENCE(ROUND(ROWS(A1:A11)/2,0)),,2,"")),-1)
 
Upvote 0
Hi all

I have a list of items that needs numbering (goes down quite a way) but I can't seem to find a formula to number each item as there is a gap after each line.

example below (which I did manually for the first few) there is always number against text then a blank row then number... I tried a few ways using sequence and counta but cant seem to get it to number sequentially. I don't mind putting the formula in helper column and then pasting over if that makes it easier

Thanks as always

on excel 365



1TextText
2TextText
3TextText
4TextText
5TextText
6TextText
I have assumed that you data starts in cell A2 but this can be altered to suit.

Conditional Formatting.xlsx
ABC
21TextText
3 
42TextText
5 
63TextText
7 
84TextText
9 
105TextText
11 
126TextText
Sheet2
Cell Formulas
RangeFormula
A2:A12A2=IF(ROW()=2,1,IF(MOD(ROW(),2)=0,MAX($A$1:$A1)+1,""))
 
Upvote 0
Thank you all for these, sorry for the delay was on a work call. I'll mark @hagia_sofia as the solution as that was first if that's ok by all

I will go through all for learning purposes @Cubist I was close to this I had the sequence function in front as various channels suggested using sequence with count but this kept giving me a spill error...

Thanks once again!
 
Last edited:
Upvote 0
Apologies quick follow up @Cubist and others feel free to input

Why does this formula =IF(C2="","",COUNTA($C$2:C2)) not work if the sequence function was added to it as the usual way to number is Sequence(Counta(B:B) so in my head

=IF(C2="","",(SEQUENCE(COUNTA($C$2:C2))
 
Upvote 0
Apologies quick follow up @Cubist and others feel free to input

Why does this formula =IF(C2="","",COUNTA($C$2:C2)) not work if the sequence function was added to it as the usual way to number is Sequence(Counta(B:B) so in my head

=IF(C2="","",(SEQUENCE(COUNTA($C$2:C2))

Hello, it is because if TRUE the formula spills a sequence of numbers. You would need to do something like:

Excel Formula:
=IF(C2="","",MAX(SEQUENCE(COUNTA($C$2:C2))))

but it is something that is not needed as @Cubist's is perfect as it is.
 
Upvote 0
Hello, it is because if TRUE the formula spills a sequence of numbers. You would need to do something like:

Excel Formula:
=IF(C2="","",MAX(SEQUENCE(COUNTA($C$2:C2))))

but it is something that is not needed as @Cubist's is perfect as it is.

Thanks for replying so another follow up (sorry) whilst on the train home hoping to learn in transit why would the MAX function make a difference here.
 
Upvote 0
Why does this formula =IF(C2="","",COUNTA($C$2:C2)) not work if the sequence function was added to it as the usual way to number is Sequence(Counta(B:B) so in my head

=IF(C2="","",(SEQUENCE(COUNTA($C$2:C2))
You're repeatedly generating sequences of 1; 1,2; 1,2,3;...ect... as you drag down so they'll overlap and cause the SPILL error.

Thanks for replying so another follow up (sorry) whilst on the train home hoping to learn in transit why would the MAX function make a difference here.
Adding MAX will eliminate the repeated values as you drag the formulas down i.e. MAX(1) = 1; MAX(1,2) = 2; MAX(1,2,3) =3; ect...
 
Last edited:
Upvote 0

Forum statistics

Threads
1,224,547
Messages
6,179,436
Members
452,915
Latest member
hannnahheileen

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