Add flag after a 1 but before 2

phil133

Active Member
Joined
May 5, 2015
Messages
257
Office Version
  1. 365
Platform
  1. Windows
Hi. I have a column with dates, a column with a smaller set of dates and a column with empty cells some 1s and 2s. 1 always comes before 2. Column D has the desired result. So when it sees a 1 then if the date is also in column B (events) it should add a 3. When it sees a 2 and until it sees a 1 again, even if the date is also in column B it should not bring a 3. I'm copying the mini-sheet. Thank you.
sample.xlsx
ABCD
1DateEventsTriggersDesired
21/1/20101/4/2010
31/4/20101/5/2020
41/5/20101/8/201011
51/6/20101/12/2020
61/7/20101/14/2010
71/8/20101/19/20103
81/11/20101/21/2020
91/12/20101/26/201022
101/13/2010
111/14/2010
121/15/2010
131/18/201011
141/19/20103
151/20/2010
161/21/20103
171/22/2010
181/25/201022
191/26/2010
201/27/2010
Sheet1
 

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.
I suggest that you update your Account details (or click your user name at the top right of the forum) so helpers always know what Excel version(s) & platform(s) you are using as the best solution often varies by version. (Don’t forget to scroll down & ‘Save’)

How about
+Fluff 1.xlsm
ABCD
1DateEventsTriggersDesired
201/01/201004/01/2010 
304/01/201005/01/2020 
405/01/201008/01/201011
506/01/201012/01/2020 
607/01/201014/01/2010 
708/01/201019/01/20103
811/01/201021/01/2020 
912/01/201026/01/201022
1013/01/2010 
1114/01/2010 
1215/01/2010 
1318/01/201011
1419/01/20103
1520/01/2010 
1621/01/2010 
1722/01/2010 
1825/01/201022
1926/01/2010 
2027/01/2010 
21
Main
Cell Formulas
RangeFormula
D2:D20D2=IF(OR(C2={1,2}),C2,IF(AND(ISNUMBER(MATCH(A2,$B$2:$B$9,0)),LOOKUP(2,1/(C$1:C1<>""),C$1:C1)=1),3,""))
 
Upvote 0
Solution
Fluff thank you. Can you please revise it a little so that if there was a 3 and 2 has not arrived yet to have another 3 if column B contains the corresponding date? For example, D16 should be 3. Thank you again. I added in my profile that I have windows and office 2016.
 
Upvote 0
A16 does not exist in col B ;)
Thanks for updating your profile.
 
Upvote 0
You're welcome & thanks for the feedback.
 
Upvote 0

Forum statistics

Threads
1,214,638
Messages
6,120,674
Members
448,977
Latest member
moonlight6

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