Sequence based on cell value

Dani_LobP

Board Regular
Joined
Aug 16, 2019
Messages
126
Office Version
  1. 365
Platform
  1. Windows
Hi all,

I'm trying to create a way to sequence rows automatically but cant seem to find the smart/short way for it.

So far i am able to build the way to sequence the Primary rows, and the secondary in a different column. My problem comes later when trying to concatenate them or put them together.

Excel Formula:
=IF(A2="Primary",COUNTIF($A$2:$A2,"Primary"),"")
Excel Formula:
=IF(A2="Secondary",COUNTIF($A$2:$A2,"Secondary"),"")
-> problem here is that it actually wont always start from 1, it will keep going incremental and wont show a 3.1 but will show as 3.3 ...

Below example of what i am trying to achieve, so that the number in column B is added automatically when i add new row, and call it primary or secondary. Each secondary below the above primary, will be related. and each primary is different as expected.

Column AColumn B
Primary1
Primary2
Secondary2.1
Secondary2.2
Primary3
Secondary3.1
Primary4

I'm hoping there's an easy way to make this sequence work.

Thanks in advance!
 

Excel Facts

Why are there 1,048,576 rows in Excel?
The Excel team increased the size of the grid in 2007. There are 2^20 rows and 2^14 columns for a total of 17 billion cells.
Try this formula (in cell B2 and copied down):
Excel Formula:
=IF(A2="Primary",INT(MAX(B$1:B1))+1,MAX(B$1:B1)+0.1)
 
Upvote 1
Solution
You are welcome.
Glad I was able to help!
 
Upvote 0

Forum statistics

Threads
1,215,073
Messages
6,122,974
Members
449,095
Latest member
Mr Hughes

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