How do I write an IF statement for number sequencing?

Sampoline

New Member
Joined
Dec 2, 2020
Messages
24
Office Version
  1. 2013
Platform
  1. Windows
How do I write a formula that achieves Column B? When a blank cell appears in Column A, Column B must also leave the cell blank. But on the next cell if there is a filled cell in Column A, it must continue the number sequence from where it was last left in Column B.

1607306399021.png
 

Excel Facts

Excel motto
Not everything I do at work revolves around Excel. Only the fun parts.
Would this do the job?

=IF(A2="","","xxx_"&TEXT(COUNTA(A$2:A2),"0000"))
Hi mrshl, this does work. Thanks for your reply. Just wondering how I would fix this now:

1607313302375.png


Need column E to use Column C to skip whenever it is "Y".

So in the above example for Column E: ABC123_0001_m, ABC123_0002_m, ABC123_0003_m, SKIP (because "Y" exists in Column C), ABC123_0004_m

How do I get this to work if you have any ideas?
 
Upvote 0
Use this for column D (D2) and drag it down:
Excel Formula:
=IF(C2="y","",A2&TEXT(ROW()-1-COUNTA(C$2:C2),"0000"))
And for column E (E2):
Excel Formula:
=IF(C2="y","",A2&TEXT(COUNTIF($A$2:A2,A2)-COUNTA(C$2:C2)+COUNTBLANK($E$1:E1),"0000")&"_m")
 
Upvote 0

Forum statistics

Threads
1,224,814
Messages
6,181,128
Members
453,021
Latest member
Justyna P

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