+ Reply to Thread
Results 1 to 7 of 7

Creating a nested SUMPRODUCT function that will bring back up to 4 different results

  1. #1
    Registered User
    Join Date
    01-07-2012
    Location
    canada
    MS-Off Ver
    Excel 2010
    Posts
    10

    Smile Creating a nested SUMPRODUCT function that will bring back up to 4 different results

    Hi,

    I recently posted a problem about creating a function for an interactive booking/reservation schedule for an aquatics community center. This is the function that was written for me by an extremely helpful poster called Haseeb:

    Please Login or Register  to view this content.
    This code basically took four different variables (Date, Start Time, End Time, Room Type) on one worksheet and linked them to the schedule on another worksheet. Based on the information, it would return a value of 1 or 0, 1 meaning the specific room was available at this time at this date and 0 meaning that it had been booked.

    I have two questions as follows(The FIRST question/problem is more important in the sense that that is the feature that I REALLY need. If you can also answer the second question, then you would more than make my day, but the first is what I really need):

    1.
    I've added another variable column to my information worksheets called TENTATIVE. I want to include this in my SUMPRODUCT function so that when the value in this column is equal to "YES", the function will compute the information along with all the other information to return a value of 2 (or any other acceptable number as long as it is different from 0,1,) The objective of this is to be able to then conditionally format the cells with this value to a separate color so that it represents a TENTATIVE booking.

    2.
    The original template that I based my design on used the the SUMPRODUCT function nested in an IF function to do what the formula above does for me. However, the main difference is that the nested IF function would automatically return a value of -1 if a room was double booked (i.e same dates/ times) while the one that I am using right now DOESN'T. I was wondering if it would be possible to do this with the function I'm using now (above)?


    Attached below is the said Workbook. You will notice that there are multiple schedules. They all use the same basic SUMPRODUCT function that I posted above, with slight variations to match each schedule. If you're playing around with fixing the problem, you can do it just for one schedule because I can adapt it to suit the others usually without problem.

    I tried playing with the function and my final failed brain wave for the first problem was the following:

    Please Login or Register  to view this content.
    It did not work. If someone could please help, I would really really appreciate it!
    Hope everyone had a good day today.

    Sam
    Attached Files Attached Files
    Last edited by slaro; 01-16-2012 at 09:44 AM.

  2. #2
    Forum Expert NBVC's Avatar
    Join Date
    12-06-2006
    Location
    Mississauga, CANADA
    MS-Off Ver
    2003:2010
    Posts
    34,898

    Re: Creating a nested SUMPRODUCT function that will bring back up to 4 different resu

    For #1, assuming you do use Excel 2010 as stated...

    Please Login or Register  to view this content.
    For No. 2, you need to state the priority sequence.. do you need to know first if the row is Tentatively assigned? Is 1 tentative and one not tentative considered double-booked, etc..
    Where there is a will there are many ways.

    If you are happy with the results, please add to the contributor's reputation by clicking the reputation icon (star icon) below left corner

    Please also mark the thread as Solved once it is solved. Check the FAQ's to see how.

  3. #3
    Registered User
    Join Date
    01-07-2012
    Location
    canada
    MS-Off Ver
    Excel 2010
    Posts
    10

    Re: Creating a nested SUMPRODUCT function that will bring back up to 4 different resu

    Hi NBVC!

    In regards to the second question I have to admit I didn't even think about defining priorities. I realize how much more complicated that make the programming. Thinking out loud, it would probably be better if instead I created a function for each individual booking sheet where if two identical bookings are made, an alert/prompt message, is delivered informing the person that they are about to create a double booking.... I will try that.

    Now in regards to the code you wrote, I do indeed have excel 2010 but your code only returns the number 2 as a response when I try it in my workbook.... I've checked it over in regards to any small reference errors and there seems to be none, so perhaps you could tell me what I'm doing wrong... I pasted it in cell B7 and dragged down and across.

    Thank's for all your help!

    Sam

  4. #4
    Forum Expert NBVC's Avatar
    Join Date
    12-06-2006
    Location
    Mississauga, CANADA
    MS-Off Ver
    2003:2010
    Posts
    34,898

    Re: Creating a nested SUMPRODUCT function that will bring back up to 4 different resu

    Perhaps I misunderstand your requirement. If you put Yes's in all the cells of the Tentative column you will see 0's appear in those date ranges.... Is that incorrect? What exactly are you expected when there are Yes's and when there are not any Yes's in the Tentative column cells?

  5. #5
    Registered User
    Join Date
    01-07-2012
    Location
    canada
    MS-Off Ver
    Excel 2010
    Posts
    10

    Re: Creating a nested SUMPRODUCT function that will bring back up to 4 different resu

    Hi NBVC,

    I apologize for the confusion.

    Right now, the way the code below works is that when a booking is made is shows up as a 0 in the time slots of the schedule and in the time slots where there is no booking, the availability is reflected as 1.

    Please Login or Register  to view this content.
    What I intend with the tentative column is that if a booking is determined to be Tentative (i.e "yes" is written in the tentative column next to the booking), I would like that booking to reflect any other number other than 0 or 1 so that I can then conditionally format it to show up in a different color. However, I still want the code to preform what it originally did; having NON-tentative bookings reflected as a 0 and availability as a 1.

    Is this explanation clearer? I've never had to really describe excel code and results before, so please just let me know if there is anything that you don't understand or that you need more clarification on.

  6. #6
    Forum Expert NBVC's Avatar
    Join Date
    12-06-2006
    Location
    Mississauga, CANADA
    MS-Off Ver
    2003:2010
    Posts
    34,898

    Re: Creating a nested SUMPRODUCT function that will bring back up to 4 different resu

    I think we just need to change the first condition to check if count is greater than 0, instead of equalling 0.

    Please Login or Register  to view this content.

  7. #7
    Registered User
    Join Date
    01-07-2012
    Location
    canada
    MS-Off Ver
    Excel 2010
    Posts
    10

    Re: Creating a nested SUMPRODUCT function that will bring back up to 4 different resu

    NBVC! It works beautifully! Thank you so very much, you really have helped me out from a fix and I am so grateful.

    I hope that you have a wonderful week.

    Take care and thanks again

    Samantha.

+ Reply to Thread

Thread Information

Users Browsing this Thread

There are currently 1 users browsing this thread. (0 members and 1 guests)

Bookmarks

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts

Search Engine Friendly URLs by vBSEO 3.6.0 RC 1