#1   Report Post  
Posted to microsoft.public.excel.misc
external usenet poster
 
Posts: 57
Default SUMPRODUCT and dates

I am trying to use a SUMPRODUCT to query the country, then the city, and most
importantly, the date a trip falls between to determine a lodging rate.

Below is an extract from the gov't per diem tables. I have the country and
city worked out, but the result is adding all lodging rates that match. In
htis example, ANTIGUA AND BARUDA would return $320, MARTINIQUE would return
$255, regardless of dates. If I enter 20 Apr, I would want $154 or $122
rerspectively.

Country City From To Max Lodging
ANTIGUA & BARBUDA ALL CONTRACTOR FACILITIES 01-Jan 31-Dec 20
ANTIGUA & BARBUDA ANTIGUA AND BARBUDA 16-Apr 14-Dec 154
ANTIGUA & BARBUDA ANTIGUA AND BARBUDA 15-Dec 15-Apr 166
MARTINIQUE MARTINIQUE 16-Apr 14-Dec 122
MARTINIQUE MARTINIQUE 15-Dec 15-Apr 133


I have tried many things without success so I do appreciate any help.
  #2   Report Post  
Posted to microsoft.public.excel.misc
external usenet poster
 
Posts: 8,520
Default SUMPRODUCT and dates

Hi Scott

With G2= ANTIGUA & BARBUDA
and G3 = 20-Apr

With your example the below formula retuns the total of the 1st two...which
falls during the date mentioned in G3...

=SUMPRODUCT(--(A1:A100=G2),--(C1:C100<=G3),--(D1:D100=G3),E1:E100)

If this post helps click Yes
---------------
Jacob Skaria


"Scott A" wrote:

I am trying to use a SUMPRODUCT to query the country, then the city, and most
importantly, the date a trip falls between to determine a lodging rate.

Below is an extract from the gov't per diem tables. I have the country and
city worked out, but the result is adding all lodging rates that match. In
htis example, ANTIGUA AND BARUDA would return $320, MARTINIQUE would return
$255, regardless of dates. If I enter 20 Apr, I would want $154 or $122
rerspectively.

Country City From To Max Lodging
ANTIGUA & BARBUDA ALL CONTRACTOR FACILITIES 01-Jan 31-Dec 20
ANTIGUA & BARBUDA ANTIGUA AND BARBUDA 16-Apr 14-Dec 154
ANTIGUA & BARBUDA ANTIGUA AND BARBUDA 15-Dec 15-Apr 166
MARTINIQUE MARTINIQUE 16-Apr 14-Dec 122
MARTINIQUE MARTINIQUE 15-Dec 15-Apr 133


I have tried many things without success so I do appreciate any help.

  #3   Report Post  
Posted to microsoft.public.excel.misc
external usenet poster
 
Posts: 15,768
Default SUMPRODUCT and dates

Hard to tell where one column ends and the next begins as far as the
country/city goes.

Try something like this:

=SUMPRODUCT(--(country_range="country"),--(city_range="city"),--(From_date<=some_date),--(To_date=some_date),range_to_sum)

--
Biff
Microsoft Excel MVP


"Scott A" wrote in message
...
I am trying to use a SUMPRODUCT to query the country, then the city, and
most
importantly, the date a trip falls between to determine a lodging rate.

Below is an extract from the gov't per diem tables. I have the country
and
city worked out, but the result is adding all lodging rates that match. In
htis example, ANTIGUA AND BARUDA would return $320, MARTINIQUE would
return
$255, regardless of dates. If I enter 20 Apr, I would want $154 or $122
rerspectively.

Country City From To Max Lodging
ANTIGUA & BARBUDA ALL CONTRACTOR FACILITIES 01-Jan 31-Dec 20
ANTIGUA & BARBUDA ANTIGUA AND BARBUDA 16-Apr 14-Dec 154
ANTIGUA & BARBUDA ANTIGUA AND BARBUDA 15-Dec 15-Apr 166
MARTINIQUE MARTINIQUE 16-Apr 14-Dec 122
MARTINIQUE MARTINIQUE 15-Dec 15-Apr 133


I have tried many things without success so I do appreciate any help.



  #4   Report Post  
Posted to microsoft.public.excel.misc
external usenet poster
 
Posts: 8,520
Default SUMPRODUCT and dates

With city in G3 and query date in G4

=SUMPRODUCT(--(A1:A100=G2),--(B1:B100=G3),--(C1:C100<=G4),--(D1:D100=G4),E1:E100)


If this post helps click Yes
---------------
Jacob Skaria


"Jacob Skaria" wrote:

Hi Scott

With G2= ANTIGUA & BARBUDA
and G3 = 20-Apr

With your example the below formula retuns the total of the 1st two...which
falls during the date mentioned in G3...

=SUMPRODUCT(--(A1:A100=G2),--(C1:C100<=G3),--(D1:D100=G3),E1:E100)

If this post helps click Yes
---------------
Jacob Skaria


"Scott A" wrote:

I am trying to use a SUMPRODUCT to query the country, then the city, and most
importantly, the date a trip falls between to determine a lodging rate.

Below is an extract from the gov't per diem tables. I have the country and
city worked out, but the result is adding all lodging rates that match. In
htis example, ANTIGUA AND BARUDA would return $320, MARTINIQUE would return
$255, regardless of dates. If I enter 20 Apr, I would want $154 or $122
rerspectively.

Country City From To Max Lodging
ANTIGUA & BARBUDA ALL CONTRACTOR FACILITIES 01-Jan 31-Dec 20
ANTIGUA & BARBUDA ANTIGUA AND BARBUDA 16-Apr 14-Dec 154
ANTIGUA & BARBUDA ANTIGUA AND BARBUDA 15-Dec 15-Apr 166
MARTINIQUE MARTINIQUE 16-Apr 14-Dec 122
MARTINIQUE MARTINIQUE 15-Dec 15-Apr 133


I have tried many things without success so I do appreciate any help.

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
SumProduct with dates Spike Excel Worksheet Functions 4 July 30th 09 12:16 AM
SUMPRODUCT with dates Jock Excel Worksheet Functions 2 October 22nd 08 03:12 PM
sumproduct with dates Jake New Users to Excel 2 March 30th 08 05:26 PM
sumproduct & dates [email protected] Excel Worksheet Functions 3 October 24th 07 03:03 AM
sumproduct with dates Bumblebee Excel Worksheet Functions 2 August 22nd 06 08:16 PM


All times are GMT +1. The time now is 04:50 PM.

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"