Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1   Report Post  
Posted to microsoft.public.excel.worksheet.functions
external usenet poster
 
Posts: 28
Default Sumproduct with more than one valid criteria

Hi,

Thanks in advance for any input you can give on this.

I'm trying to organize a messy schedule, so I'm using the sumproduct
function. The data available comes like this:

Room StDate EndDate Day Outdoor=1/Indoor=2
1 5/30 7/15 M 1
3 6/2 8/3 TW 2


So I made a calendar for each room and I'm using this expression (sorry):

=IF(SUMPRODUCT(--(Sheet1!$A$2:$A$300=Room),--(StDate=Sheet1!$C$2:$C$300),--(EndDate<=Sheet1!$D$2:$D$300),--(ISNUMBER(SEARCH(Day,Sheet1!$E$2:$E$300))))=1,"Out door",IF(SUMPRODUCT(--(Sheet1!$A$2:$A$300=Room),--(StDate=Sheet1!$C$2:$C$300),--(EndDate<=Sheet1!$D$2:$D$300),--(ISNUMBER(SEARCH(Day,Sheet1!$E$2:$E$300))))=2,"Ind oor",""))

PROBLEM: The problem is that if I have more than one event scheduled the
same day, the formula goes with the second criteria, and if there is 3er
event scheduled the same day, the day appears available. I.e.:

If I have ONE event on 5/30, the formula will give "outdoor" or "indoor" (it
works as it should be)

If I have TWO events on 5/30, the formula will give "indoor" (the 2nd
criteria, whether the event is outdoor or indoor)

If I have THREE events on 5/30, the formula will give " " (like the day
would be available, whether the event is outdoor or indoor)

I would like that the formula stops if the first criteria is valid.

Hope someone can help me. Thanks


  #2   Report Post  
Posted to microsoft.public.excel.worksheet.functions
external usenet poster
 
Posts: 5,441
Default Sumproduct with more than one valid criteria

Lilly,

You can use an array-entered formula (enter using Ctrl-Shift-Enter) like:

=INDEX(F:F,MIN(IF(Sheet1!$A$2:$A$300=Room, IF(Sheet1!$C$2:$C$300<=StDate,
IF(Sheet1!$D$2:$D$300=EndDate,IF(ISNUMBER(SEARCH( Day,Sheet1!$E$2:$E$300)),ROW($A$2:$A$300)))))))

which will return 1 or 2 from the first matching value, or

=INDEX(F:F,MAX(IF(Sheet1!$A$2:$A$300=Room, IF(Sheet1!$C$2:$C$300<=StDate,
IF(Sheet1!$D$2:$D$300=EndDate,IF(ISNUMBER(SEARCH( Day,Sheet1!$E$2:$E$300)),ROW($A$2:$A$300)))))))

which will return the 1 or 2 from the last matching value.

Then you can use those cells to feed the IF( =1, "Indoor", "Outdoor")
formula.

HTH,
Bernie
MS Excel MVP


"Lily" wrote in message
...
Hi,

Thanks in advance for any input you can give on this.

I'm trying to organize a messy schedule, so I'm using the sumproduct
function. The data available comes like this:

Room StDate EndDate Day Outdoor=1/Indoor=2
1 5/30 7/15 M 1
3 6/2 8/3 TW 2


So I made a calendar for each room and I'm using this expression (sorry):

=IF(SUMPRODUCT(--(Sheet1!$A$2:$A$300=Room),--(StDate=Sheet1!$C$2:$C$300),--(EndDate<=Sheet1!$D$2:$D$300),--(ISNUMBER(SEARCH(Day,Sheet1!$E$2:$E$300))))=1,"Out door",IF(SUMPRODUCT(--(Sheet1!$A$2:$A$300=Room),--(StDate=Sheet1!$C$2:$C$300),--(EndDate<=Sheet1!$D$2:$D$300),--(ISNUMBER(SEARCH(Day,Sheet1!$E$2:$E$300))))=2,"Ind oor",""))

PROBLEM: The problem is that if I have more than one event scheduled the
same day, the formula goes with the second criteria, and if there is 3er
event scheduled the same day, the day appears available. I.e.:

If I have ONE event on 5/30, the formula will give "outdoor" or "indoor"
(it
works as it should be)

If I have TWO events on 5/30, the formula will give "indoor" (the 2nd
criteria, whether the event is outdoor or indoor)

If I have THREE events on 5/30, the formula will give " " (like the day
would be available, whether the event is outdoor or indoor)

I would like that the formula stops if the first criteria is valid.

Hope someone can help me. Thanks




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 two valid criteria Lily Excel Worksheet Functions 1 March 27th 10 04:46 AM
add two criteria that should not be met to sumproduct Diddy Excel Worksheet Functions 4 March 3rd 09 12:48 PM
SUMPRODUCT using more than 2 criteria? Max Excel Worksheet Functions 0 August 17th 07 02:23 AM
sumproduct and IF criteria?? ferde Excel Discussion (Misc queries) 5 March 24th 07 06:11 PM
SUMPRODUCT with 3 criteria Kierano Excel Discussion (Misc queries) 1 October 16th 06 05:16 PM


All times are GMT +1. The time now is 09:18 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"