Repeat or Keep previous value while On/Off condition met

GeeWhiz7

Board Regular
Joined
Nov 22, 2021
Messages
214
Office Version
  1. 365
Platform
  1. Windows
  2. MacOS
Hi Gurus,
I have a table of values that I would like repeat in a new column only if certain condition is met.
In this case, Column 1 has the values, Column 2 has the condition On=1, Off=Blank.

Id like column 3 to have values equal to column 1 if column 2 is blank and while column 2 is on=value of 1, I would like to repeat the first value (12 in this case) until the condition is not met.
I can figure this out with multiple columns, but can't quite get it to work in this simple form.

Ideas are appreciated! Thanks!
1639683858298.png
 

Attachments

  • 1639683705893.png
    1639683705893.png
    5.2 KB · Views: 6

Excel Facts

Can you sort left to right?
To sort left-to-right, use the Sort dialog box. Click Options. Choose "Sort left to right"
Cell C3: =IF(AND(B3=1,B2=1),C2,A3)
Hi Jeffrey, you have helped me before.

Using the C3 formula gives me a couple of things I'm not sure how to fix including a circular reference.

1639690603598.png


If I modify it a bit I get the start of the repeating values to occur in the right place (C6), but not the right values (12) and I still get a circular reference.
1639690771532.png


-Will
 
Upvote 0
How about
+Fluff 1.xlsm
ABC
1ValueOn/OffResult
26565
32323
499
52222
612112
71112
84112
95112
102112
111010
1222
1355
14
Main
Cell Formulas
RangeFormula
C2:C13C2=INDEX($A$2:$A$13,ROWS(C$2:C2)-IF(B2=1,SUM(B$1:B1),0))
 
Upvote 0
Solution
Glad we could help & thanks for the feedback.
 
Upvote 0
Hi Jeffrey, you have helped me before.

Using the C3 formula gives me a couple of things I'm not sure how to fix including a circular reference.

View attachment 53551

If I modify it a bit I get the start of the repeating values to occur in the right place (C6), but not the right values (12) and I still get a circular reference.
View attachment 53552

-Will
You put the formula in cell C2, not C3
 
Upvote 0

Forum statistics

Threads
1,215,519
Messages
6,125,299
Members
449,218
Latest member
Excel Master

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