Lookup date in range then find on another sheet

Cuzman

New Member
Joined
May 17, 2011
Messages
10
I have been trying to find a way i can automate this work...
I have a list of dates that i enter on to sheet 1. I then have to go onto sheet 2 or 3 and find those dates and highlight that column in red.

I'm sure this can be done with a macro but can't think where to start...can anyone help?
 

Excel Facts

Can Excel fill bagel flavors?
You can teach Excel a new custom list. Type the list in cells, File, Options, Advanced, Edit Custom Lists, Import, OK
Hi
I'm assuming that on your sheets 2 and 3 the dates are the column headers. If this isn't the case then this won't work but it might give you an idea to develop.

You can do this with Conditional Formatting but it just needs a bit of extra work. First of all define a dynamic named range so that the list of dates can be any length. Go Insert | Name | Define. Type a name in the top box like Dates. Then in the "Refers to" box type

=OFFSET(Sheet1!$A$1,0,0,COUNTA(Sheet1!$A:$A),1)

but change this to your sheet name, column and the first cell that you will have the dates in. Then click Add and Close. This gives you a flexible named list of dates that other formulae can refer to.

Go to your other sheet(s) and select the columns that have the dates as the headers. Go Format |Conditional Formatting and select "Formula is" from the drop down. In the box next to this enter the following (again alter the start cell to suit your data)

=IF(ISERROR(VLOOKUP(A$1,Dates,1,FALSE)),1,0)=0

Choose the formatting you want and click okay.

This should be all you need to do. All the cells in a given column will be formatted if the date in the header row appears in the list of dates on the other sheet.

Cheers

Gordon
 
Upvote 0
Thanks Gordon,<?xml:namespace prefix = o ns = "urn:schemas-microsoft-com:office:office" /><o:p></o:p>
That works well but unfortunately only on the first sheet…not the second…for some reason it is highlighting random columns.<o:p></o:p>
You are right in thinking I have dates in the column header on sheets 2 and 3…<o:p></o:p>
sheet2 has dates 01/01/11 – 30/6/11 and the remainder of the year on sheet3<o:p></o:p>
<o:p> </o:p>
The dates are on sheet1 starting at F19 therefore I have defined the following as Dates<o:p></o:p>
=OFFSET(sheet1!$F$19,0,0,COUNTA(sheet1!$F:$F),1)<o:p></o:p>
<o:p> </o:p>
On sheets1&2 I have entered =IF(ISERROR(VLOOKUP(A$2,Dates,1,FALSE)),1,0)=0
<o:p> </o:p>
As the dates are actually in row 2…
<o:p> </o:p>
Does this correct?
<o:p> </o:p>
Mark
 
Upvote 0
Hi Mark
That looks correct to me. I can't think what the problem with the second sheet might be other than the way the dates are entered. Sometimes it's difficult to convince Excel that the dates you've entered are not American format. Also make sure that the formatting formula is exactly the same for both sheets.

Cheers

Gordon
 
Upvote 0
Well thanks again for your help Gordon...I'll have a play and see if i can get it to work.

Mark
 
Upvote 0

Forum statistics

Threads
1,224,603
Messages
6,179,850
Members
452,948
Latest member
UsmanAli786

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