Continuously numbering (conditional) with reset

jules_05

New Member
Joined
Feb 2, 2015
Messages
4
Hi all,

first of all, I am looking forward to a productive cooperation with all of you guys :) It's my first post, so let's get it up and running!

My problem is the following:
I would need a continuously, conditional numbering with a reset function. Let me give you guys an example for a better understanding:



AB
1HeaderHT
2Position001
3Position002
4Position003
5HeaderHT
6Position001
7Position002
n......

<tbody>
</tbody>

In column A I have the text 'Header' or 'Position'. In column B I have 'HT' with every cell in column A which contains the text 'Header' - so far so good. What I wanna do is, create a formula which reads the text in column A and give me a continuous numbering with the condition to start over when there is the text 'Header' in column A.
So something like this: $B1=IF($A1='Header','HT',......count & reset if column A='Header')

I hope you guys understood my problem and useful answers, tips and hints are very much appreciated!

Thanks in advance,
Jules
 

Excel Facts

Copy PDF to Excel
Select data in PDF. Paste to Microsoft Word. Copy from Word and paste to Excel.
try the following, I am sure someone will come up with a better solution

I inserted a row of headers to make the following work and inserted the following in B2

=IF(A2="Header","HT",MAX(--(A2="Header"),B1)+1)

I then formatted the column with custom format of 000, as converting the result with TEXT(..., throws the formula into returning 1 on each row
 
Last edited:
Upvote 0
=IF(A2="Header","HT",MAX(0,B1)+1)

will suffice.


Unfortunately this gives me the following:


I've entered the following formula for cell AN3 (see the screenshot) and copied it down...:(
Code:
=IF($AM3="Header","HT",MAX($AN2,0)+1))


Did I do anything wrong?
 
Upvote 0
Hi,

I suggest the following:

In the first row you enter "HT" by hand.
Below you use the formula (here for C2)
Code:
 =IF(A2="Header","HT",IF(C1="HT",1,1+C1))


J.Ty.
 
Last edited:
Upvote 0

Forum statistics

Threads
1,216,466
Messages
6,130,795
Members
449,593
Latest member
morpheous

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