How to find first Monday which meets criteria

DDT123

New Member
Joined
Aug 9, 2011
Messages
37
Office Version
  1. 365
Platform
  1. Windows
Greetings All,

I have a list of dates in column A and a list of names in column B. I'm trying to find the first Monday in column A if the name in column B equals "John". Next, I'd want to list the second Monday in A if the name in column B equals "John". What would be the formulas for this?

Thanks in advance!!
 

Excel Facts

Last used cell?
Press Ctrl+End to move to what Excel thinks is the last used cell.
Try:

VBA Code:
=FILTER(A2:A100,(WEEKDAY(A2:A100,2)=1)*(B2:B100="John"))
Thank you, that worked! I was originally entering "A:A" instead of including start/end row numbers. It worked after I entered a specific range.
 
Upvote 0
You could also avoid VBA by using the formula:
Excel Formula:
=INDEX( FILTER( A2:A100, ( WEEKDAY( A2:A100, 2 ) = 1)  * ( B2:B100 = "John" ), "no date matches" ), 1 )

If your data is in a table (or you convert it one), you could use:
Excel Formula:
=INDEX( FILTER( Table1[Date], ( WEEKDAY( Table1[Date], 2 ) = 1 ) * ( Table1[Name] = "John" ), "no date matches" ), 1 )
 
Upvote 0
You could also avoid VBA by using the formula:
Excel Formula:
=INDEX( FILTER( A2:A100, ( WEEKDAY( A2:A100, 2 ) = 1)  * ( B2:B100 = "John" ), "no date matches" ), 1 )

If your data is in a table (or you convert it one), you could use:
Excel Formula:
=INDEX( FILTER( Table1[Date], ( WEEKDAY( Table1[Date], 2 ) = 1 ) * ( Table1[Name] = "John" ), "no date matches" ), 1 )
I forgot to say:
Increment the number "1" for the index function as required i.e. code "2" to get your second match. You'll need to handle "there isn't a valid match" gracefully of course to avoid a # error value.
 
Upvote 0

Forum statistics

Threads
1,215,136
Messages
6,123,247
Members
449,093
Latest member
Vincent Khandagale

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