Insert increasing number into adjacent cells with the same value

Tondonik

New Member
Joined
Dec 31, 2019
Messages
2
Office Version
  1. 2007
Platform
  1. Windows
Hello everyone,
I have a column with values either 0 or 1. Everytime there is one or more 0 below together, I need them to be replaced with increasing values by 1 and do not change the lines with previous 1. Like this:

11 /*no change
11 /*no change
01 /*+1
1transform into ->1 /*no change
01 /*+1
02 /*+2 (or previous cell +1)
03 /* +3 (or previous cell +1)
11 /* no change

Do you have any ideas? It needs to be done due to logistics reasons where adjacent zeroes represent a new line with another product of the same order, just for your information.
I will be greatful for your help.
Tony
 

Excel Facts

Workdays for a market open Mon, Wed, Friday?
Yes! Use "0101011" for the weekend argument in NETWORKDAYS.INTL or WORKDAY.INTL. The 7 digits start on Monday. 1 means it is a weekend.
Hi & welcome to MrExcel.
How about
Book1
AB
1OldNew
211
311
401
511
611
701
802
903
1011
Report
Cell Formulas
RangeFormula
B2:B10B2=IF(AND(A2=0,A1=0),B1+1,IF(A2=0,1,A2))
 
Upvote 0
Hi & welcome to MrExcel.
How about
Book1
AB
1OldNew
211
311
401
511
611
701
802
903
1011
Report
Cell Formulas
RangeFormula
B2:B10B2=IF(AND(A2=0,A1=0),B1+1,IF(A2=0,1,A2))
Hello Fluff and thank you so much!!! It works just great. I have not yet learned how to use IF/AND in Excel but will do now, it seems quite powerfull.
Have a nice day and all the best into 2020.
Tony
 
Upvote 0
You're welcome & thanks for the feedback
 
Upvote 0

Forum statistics

Threads
1,223,898
Messages
6,175,274
Members
452,628
Latest member
dd2

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