Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1   Report Post  
Posted to microsoft.public.excel.misc
external usenet poster
 
Posts: 989
Default Q: criteria based vlookup

I have a table of codes, fees, and change dates such as below. The change
dates can happen at any point and the fees do not fall into any pattern. the
list is sorted by code ascending and change date ascending.

code fee change date
AA 10 1/1/2007
AA 15 1/15/2007
AA 12 2/20/2007
....
BB 5 1/1/2007
BB 10 1/23/2007
....


I have a list of records with codes and dates and have to lookup against
this list to find the lastest date change before the date on the record and
return the fee (ie. if the date on the record says 1/10/2007 for code AA, i'd
return the fee 10).

If there was only one code in the lookup, this would be simple. I'd just do
a vlookup(,,,FALSE) against the lookup table to return the fee. However,
since there are multiple codes, this isn't as easy.

Hopefully that makes sense. I'm looking for a solution *without* using VBA.
I have some code that does this already, but I figure it's worth a shot to
see whether this can be done through worksheet functions alone.

Thanks,
-Mark


  #2   Report Post  
Posted to microsoft.public.excel.misc
external usenet poster
 
Posts: 347
Default Q: criteria based vlookup

Hi,

Try this Array formula:

=SUMPRODUCT((A1:A100="aa")*(C1:C100=MAX(IF(C1:C100 <DATE(2007,1,15),C1:C100))),B1:B100)

enter using Ctrl+Shift+Enter

HTH
Jean-Guy
"Mark" wrote:

I have a table of codes, fees, and change dates such as below. The change
dates can happen at any point and the fees do not fall into any pattern. the
list is sorted by code ascending and change date ascending.

code fee change date
AA 10 1/1/2007
AA 15 1/15/2007
AA 12 2/20/2007
...
BB 5 1/1/2007
BB 10 1/23/2007
...


I have a list of records with codes and dates and have to lookup against
this list to find the lastest date change before the date on the record and
return the fee (ie. if the date on the record says 1/10/2007 for code AA, i'd
return the fee 10).

If there was only one code in the lookup, this would be simple. I'd just do
a vlookup(,,,FALSE) against the lookup table to return the fee. However,
since there are multiple codes, this isn't as easy.

Hopefully that makes sense. I'm looking for a solution *without* using VBA.
I have some code that does this already, but I figure it's worth a shot to
see whether this can be done through worksheet functions alone.

Thanks,
-Mark


  #3   Report Post  
Posted to microsoft.public.excel.misc
external usenet poster
 
Posts: 989
Default Q: criteria based vlookup

Hmmm... I haven't used array formulas that often. I'll have to test this out
first. If possible, could you give a one or two line summary of what your
formula does? somehow, I don't think it's what I'm looking for.

I probably didn't do a very good job explaining my question.

"pinmaster" wrote:

Hi,

Try this Array formula:

=SUMPRODUCT((A1:A100="aa")*(C1:C100=MAX(IF(C1:C100 <DATE(2007,1,15),C1:C100))),B1:B100)

enter using Ctrl+Shift+Enter

HTH
Jean-Guy
"Mark" wrote:

I have a table of codes, fees, and change dates such as below. The change
dates can happen at any point and the fees do not fall into any pattern. the
list is sorted by code ascending and change date ascending.

code fee change date
AA 10 1/1/2007
AA 15 1/15/2007
AA 12 2/20/2007
...
BB 5 1/1/2007
BB 10 1/23/2007
...


I have a list of records with codes and dates and have to lookup against
this list to find the lastest date change before the date on the record and
return the fee (ie. if the date on the record says 1/10/2007 for code AA, i'd
return the fee 10).

If there was only one code in the lookup, this would be simple. I'd just do
a vlookup(,,,FALSE) against the lookup table to return the fee. However,
since there are multiple codes, this isn't as easy.

Hopefully that makes sense. I'm looking for a solution *without* using VBA.
I have some code that does this already, but I figure it's worth a shot to
see whether this can be done through worksheet functions alone.

Thanks,
-Mark


  #4   Report Post  
Posted to microsoft.public.excel.misc
external usenet poster
 
Posts: 347
Default Q: criteria based vlookup

Hi,

I"m not an expert but I'll try as best I can.

the formula will look in column A for the value "AA" and look in column C
for the largest date that is less than the date to lookup and will return the
matching value in column B, since there's only one possible result SUMPRODUCT
should work just fine.

P.S. don't forget to enter the formula using Ctrl+Shift+Enter

Regards!
Jean-Guy

"Mark" wrote:

Hmmm... I haven't used array formulas that often. I'll have to test this out
first. If possible, could you give a one or two line summary of what your
formula does? somehow, I don't think it's what I'm looking for.

I probably didn't do a very good job explaining my question.

"pinmaster" wrote:

Hi,

Try this Array formula:

=SUMPRODUCT((A1:A100="aa")*(C1:C100=MAX(IF(C1:C100 <DATE(2007,1,15),C1:C100))),B1:B100)

enter using Ctrl+Shift+Enter

HTH
Jean-Guy
"Mark" wrote:

I have a table of codes, fees, and change dates such as below. The change
dates can happen at any point and the fees do not fall into any pattern. the
list is sorted by code ascending and change date ascending.

code fee change date
AA 10 1/1/2007
AA 15 1/15/2007
AA 12 2/20/2007
...
BB 5 1/1/2007
BB 10 1/23/2007
...


I have a list of records with codes and dates and have to lookup against
this list to find the lastest date change before the date on the record and
return the fee (ie. if the date on the record says 1/10/2007 for code AA, i'd
return the fee 10).

If there was only one code in the lookup, this would be simple. I'd just do
a vlookup(,,,FALSE) against the lookup table to return the fee. However,
since there are multiple codes, this isn't as easy.

Hopefully that makes sense. I'm looking for a solution *without* using VBA.
I have some code that does this already, but I figure it's worth a shot to
see whether this can be done through worksheet functions alone.

Thanks,
-Mark


  #5   Report Post  
Posted to microsoft.public.excel.misc
external usenet poster
 
Posts: 347
Default Q: criteria based vlookup

Hi,

Made a small adjustment to the formula, here's the latest version:

=SUMPRODUCT((E4:E7="aa")*(G4:G7=MAX(IF((G4:G7<DATE (2007,1,10))*(E4:E7="aa"),G4:G7))),F4:F7)

this formula will look in column C for the latest date that is less than the
lookup date that also matches "AA" in column A

HTH
Jean-Guy

"pinmaster" wrote:

Hi,

I"m not an expert but I'll try as best I can.

the formula will look in column A for the value "AA" and look in column C
for the largest date that is less than the date to lookup and will return the
matching value in column B, since there's only one possible result SUMPRODUCT
should work just fine.

P.S. don't forget to enter the formula using Ctrl+Shift+Enter

Regards!
Jean-Guy

"Mark" wrote:

Hmmm... I haven't used array formulas that often. I'll have to test this out
first. If possible, could you give a one or two line summary of what your
formula does? somehow, I don't think it's what I'm looking for.

I probably didn't do a very good job explaining my question.

"pinmaster" wrote:

Hi,

Try this Array formula:

=SUMPRODUCT((A1:A100="aa")*(C1:C100=MAX(IF(C1:C100 <DATE(2007,1,15),C1:C100))),B1:B100)

enter using Ctrl+Shift+Enter

HTH
Jean-Guy
"Mark" wrote:

I have a table of codes, fees, and change dates such as below. The change
dates can happen at any point and the fees do not fall into any pattern. the
list is sorted by code ascending and change date ascending.

code fee change date
AA 10 1/1/2007
AA 15 1/15/2007
AA 12 2/20/2007
...
BB 5 1/1/2007
BB 10 1/23/2007
...


I have a list of records with codes and dates and have to lookup against
this list to find the lastest date change before the date on the record and
return the fee (ie. if the date on the record says 1/10/2007 for code AA, i'd
return the fee 10).

If there was only one code in the lookup, this would be simple. I'd just do
a vlookup(,,,FALSE) against the lookup table to return the fee. However,
since there are multiple codes, this isn't as easy.

Hopefully that makes sense. I'm looking for a solution *without* using VBA.
I have some code that does this already, but I figure it's worth a shot to
see whether this can be done through worksheet functions alone.

Thanks,
-Mark


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
VLookup based on two criteria [email protected] Excel Discussion (Misc queries) 3 August 28th 07 11:16 PM
VLookup based on two criteria [email protected] Excel Discussion (Misc queries) 2 August 28th 07 10:22 PM
Looking up values based on two criteria LauriS Excel Worksheet Functions 8 August 24th 07 02:30 PM
Add a row based on other criteria Joe Gieder Excel Worksheet Functions 4 June 15th 07 06:22 PM
Need help looking up value based on criteria akbreezo Excel Worksheet Functions 7 June 15th 05 10:53 PM


All times are GMT +1. The time now is 01:16 PM.

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

About Us

"It's about Microsoft Excel"