Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1   Report Post  
Posted to microsoft.public.excel.misc
external usenet poster
 
Posts: 313
Default VBA Vlookup using high & low date comparison

I have a spreadsheet that uses a code (CWW1, CWW2, CWW#, etc) to determine
whether a cell will have the value €œCWW€ based on a persons name and a
corresponding weekday date of the month. Using a monthly low date (Start Date
Apr 1, 2009) and a monthly high (End Date April 30, 2009, the code uses
Vlookup to search a named range (CWWLIST) and pick out a date that falls in
between the low & high dates in the CWW column (i.e. €œCWW6€). This is
extremely complicated for me to figure out but I do need it for a spreadsheet
that my Manager has requested.

Source Code
----------------
Low Date - Cell BA1 €“ 04/01/2009
High Date - Cell BB1 €“ 04/30/2009
CWW Code - wsPh.Range("a" & emcnt) €“ €œCWW6€
Employee Name - wsPh.Range("ai" & emcnt)


CWWList Named Range
------------------------------

(Columns) A B C D E F
CWW1 CWW2 CWW3 CWW4 CWW5 CWW6 (Row 1)
3/16/09 3/20/09 3/23/09 3/27/09 3/30/09 4/03/09

Target Worksheet
----------------------

(Columns) A B C D E
Weekdays M T W TH F (Row 3)
1 2 3 (Row 4)
€œ€ €œ€ CWW (Row 5)

The date in €œE4€ should be = to Low Date in €œBA1€ and <= High Date in
€œBB1€ to make sure it is within the monthly range and then the formula that
is placed in €œE5€ should do a vlookup in range CWWList to find the date
€œ04/03/2009€ which will result in €œCWW€ placed in cell €œE5€. The formula
placed by VBA code should look something like this.

=IF(AND(DATE(YEAR(H$3),MONTH(H$3),DAY(H$3))<=DATE( YEAR($AM$1),MONTH($AM$1),DAY($AM$1)),DATE(YEAR(H$3 ),MONTH(H$3),DAY(H$3))<=DATE(YEAR($AN$1),MONTH($AN $1),DAY($AN$1))),€Vlookup,CWWLIST,x,xx€,€€ )

Reply
Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes

Posting Rules

Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On


Similar Threads
Thread Thread Starter Forum Replies Last Post
Date comparison adimar Excel Worksheet Functions 14 February 3rd 08 06:44 PM
Date comparison TomD Excel Discussion (Misc queries) 4 February 20th 07 10:37 PM
Vlookup for data comparison/validation? Linda1949 Excel Worksheet Functions 2 January 9th 07 03:16 AM
VLOOKUP using another table for comparison values Karen S. Excel Worksheet Functions 3 June 15th 06 09:56 PM
Date Comparison with VLookup techiemom60 Excel Worksheet Functions 1 March 26th 06 10:00 PM


All times are GMT +1. The time now is 05:15 AM.

Powered by vBulletin® Copyright ©2000 - 2024, Jelsoft Enterprises Ltd.
Copyright ©2004-2024 ExcelBanter.
The comments are property of their posters.
 

About Us

"It's about Microsoft Excel"