Search column for next of a given value?

dobby1303

New Member
Joined
Feb 10, 2016
Messages
37
Hi all,

I'm trying to search through a column of A's, B's and null return values for the next instance of A or B, can anyone help?

The formula I'm working with is currently working with dates to find the date of the next monday in a week A or B (school 2 week timetable), when I get to school holidays it is neither week A or B, so the null value is returned. At the moment the formula is set to find date 1 week after. The problem I have is that it's not always 1 week later I'm looking for, sometimes it's two weeks, is there a formula that can do this for me?

At the moment I have:

=IF(OR(INDEX(C:C,MATCH(TODAY()+(7-WEEKDAY(TODAY(),2)+1),E:E))="A",INDEX(C:C,MATCH(TODAY()+(7-WEEKDAY(TODAY(),2)+1),E:E))="B"),TODAY()+(7-WEEKDAY(TODAY(),2)+1),TODAY()+(7-WEEKDAY(TODAY(),2)+8))

Basically, if next monday's date is in A or B, return next monday's date, if not return the monday after.
It's that final part in bold that I'm looking to change to "search for the next monday with A or B".
 
Last edited:

Excel Facts

Fastest way to copy a worksheet?
Hold down the Ctrl key while dragging tab for Sheet1 to the right. Excel will make a copy of the worksheet.
sorry, that should say (edit button has disappeared):

Basically, if next monday's date (in column E) is in week A or B (in column C), return next monday's date, if not return the monday after.
 
Upvote 0
Can you post an example of your data layout and expected results?
 
Upvote 0
I'm looking for it to return the date of the next Monday which falls in a week A or week B, it is working at the moment, as long as that is either the coming Monday, or the one after, I can't seem to get it to work if I need it to be potentially the Monday after that.

the data looks like this, although the issue comes from longer than a week of null values

BMon21/05/18
BTue22/05/18
BWed23/05/18
BThu24/05/18
BFri25/05/18
Mon28/05/18
Tue29/05/18
Wed30/05/18
Thu31/05/18
Fri01/06/18
AMon04/06/18
ATue05/06/18
AWed06/06/18
AThu07/06/18
AFri08/06/18

<tbody>
</tbody>

Should return "04/06/18", if the break is longer than 2 weeks it doesn't work though
 
Last edited:
Upvote 0

Forum statistics

Threads
1,215,035
Messages
6,122,791
Members
449,095
Latest member
m_smith_solihull

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