Search an array located by referencing a date match

240racr

New Member
Joined
Nov 3, 2016
Messages
34
Hello all; new to the board.

I'm really stuck on a problem. I'm trying to write a formula that will be used in conditional formatting. I have a calendar that uses macros and self populates the days when selecting a year using a spin button. I want to conditional format each day to change color based on the word 'down' located on another sheet. The other sheet has 10 years worth of dates and time slots; so it's a rather large sheet. I need to find the date (on the data sheet) that matches the date on the calendar, then based on that location it would search a predetermined area for 'down' based on the location of the found matching date. Yeah, probably not the best explanation...

Here is what I came up with (which obviously doesn't work) by just looking up how to use different functions.
=COUNTIF(OFFSET(MATCH(B11,TimeStamp!A1:A6955,0),2,1,17,3),"*down*")


  • B11 is the cell that contains self populated date
  • TimeStamp!A1:A6955 is column that contains dates & times for the first year. The next year starts on F1.

Any help is greatly appreciated.
 
The tables go across and down. Years go to the right and days go down.

ie. Dates are in the following cells and continue through 2025 and 365 days/year (plus leap year days)

AFKP....
21/1/20161/1/20171/1/20181/1/2019...
211/2/20161/2/20171/2/20181/2/2019
401/3/20161/3/20171/3/20181/3/2019
59...1/4/2016...1/4/2017...1/4/2018...1/4/2019...

<tbody>
</tbody>

That table has helped: You could give this lengthy formula a try.

Code:
=COUNTIF(OFFSET(INDEX(INDEX(TimeStamp!$A$2:$AW$6955,0,MATCH(DATE(YEAR(B11),1,1),TimeStamp!$A$2:$AW$2,0)),MATCH(B11,INDEX(TimeStamp!$A$2:$AW$6955,0,MATCH(DATE(YEAR(B11),1,1),TimeStamp!$A$2:$AW$2,0)),0)),2,1,17,3),"*down*")
 
Upvote 0

Excel Facts

Move date out one month or year
Use =EDATE(A2,1) for one month later. Use EDATE(A2,12) for one year later.
That table has helped: You could give this lengthy formula a try.

Rich (BB code):
=COUNTIF(OFFSET(INDEX(INDEX(TimeStamp!$A$2:$AW$6955,0,MATCH(DATE(YEAR(B11),1,1),TimeStamp!$A$2:$AW$2,0)),MATCH(B11,INDEX(TimeStamp!$A$2:$AW$6955,0,MATCH(DATE(YEAR(B11),1,1),TimeStamp!$A$2:$AW$2,0)),0)),2,1,17,3),"*down*")

That is so freaking amazing!!!! That worked and I don't 100% understand what it's doing. THANK YOU!!

I just had to change the following parts for each cell across, then format paint the rows down on my calendar. Now the calendar works perfectly!
Rich (BB code):
=COUNTIF(OFFSET(INDEX(INDEX(TimeStamp!$A$2:$AW$6955,0,MATCH(DATE(YEAR($B11),1,1),TimeStamp!$A$2:$AW$2,0)),MATCH($B11,INDEX(TimeStamp!$A$2:$AW$6955,0,MATCH(DATE(YEAR($B11),1,1),TimeStamp!$A$2:$AW$2,0)),0)),2,1,17,3),"*down*")
Rich (BB code):
=COUNTIF(OFFSET(INDEX(INDEX(TimeStamp!$A$2:$AW$6955,0,MATCH(DATE(YEAR($C11),1,1),TimeStamp!$A$2:$AW$2,0)),MATCH($C11,INDEX(TimeStamp!$A$2:$AW$6955,0,MATCH(DATE(YEAR($C11),1,1),TimeStamp!$A$2:$AW$2,0)),0)),2,1,17,3),"*down*")
Rich (BB code):
=COUNTIF(OFFSET(INDEX(INDEX(TimeStamp!$A$2:$AW$6955,0,MATCH(DATE(YEAR($D11),1,1),TimeStamp!$A$2:$AW$2,0)),MATCH($D11,INDEX(TimeStamp!$A$2:$AW$6955,0,MATCH(DATE(YEAR($D11),1,1),TimeStamp!$A$2:$AW$2,0)),0)),2,1,17,3),"*down*")
 
Upvote 0

Forum statistics

Threads
1,216,114
Messages
6,128,910
Members
449,478
Latest member
Davenil

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