Reset incremental counter based on value in adjacent column

Arline

New Member
Joined
Sep 1, 2016
Messages
2
Hi there! I would really appreciate your help with creating a formulae which will achieve the expected IDs below. Each time Level = 1, the counter for Expected ID should reset to 0 and start to increment by 1 again.

LevelExpected ID
10
21
22
23
10
21
10
10
21
22
23
24

It should not do the following:
LevelExpected ID
11
21
22
23
10
24
10
10
25
26
27
28


Any help will be greatly appreciated!:biggrin::biggrin::biggrin:

<tbody>
</tbody><colgroup><col><col></colgroup>

<tbody>
</tbody><colgroup><col><col></colgroup>
 

Excel Facts

What do {} around a formula in the formula bar mean?
{Formula} means the formula was entered using Ctrl+Shift+Enter signifying an old-style array formula.
Hi Arline,

Assuming your Levels are in Column A starting in cell A1, and your Expected IDs are in Column B:

In Cell B1: =IF(A1=1,0,"What you want if the first Level is not 1") - change the bit in red to whatever should appear if the first Level is not 1.
In Cell B2: =IF(A2=1,0,B1+1)

Then copy down the formula in cell B2 as far as you need.

If the first Level in Column A is always going to be 0, therefore the first Expected ID in Column B should always be 0, just enter a 0 in B1, and use the same formula in B2 to copy down.

Good luck,

AP
 
Last edited:
Upvote 0

Forum statistics

Threads
1,215,575
Messages
6,125,620
Members
449,240
Latest member
lynnfromHGT

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