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:
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.=(SUMPRODUCT(--(ConferenceRooms!$D$2:$D$100=LOOKUP(9E300,$B$5:B$5)),--(ConferenceRooms!$G$2:$G$100=B$6),--(ConferenceRooms!$F$2:$F$100>=$A7),--(ConferenceRooms!$E$2:$E$100<=$A7+"00:29"))=0)+0
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:
It did not work. If someone could please help, I would really really appreciate it!IF(AND((SUMPRODUCT(--(ConferenceRooms!$E$2:$E$100=LOOKUP(9E+300,$B$5:G$5)),--(ConferenceRooms!$H$2:$H$100=G$6),--(ConferenceRooms!$G$2:$G$100>=$A10),--(ConferenceRooms!$F$2:$F$100<=$A10+"00:29"))=0)+0,'ConferenceRooms'!$D$2:$D$100="Yes"),2,((SUMPRODUCT(--(ConferenceRooms!$E$2:$E$100=LOOKUP(9E+300,$B$5:G$5)),--(ConferenceRooms!$H$2:$H$100=G$6),--(ConferenceRooms!$G$2:$G$100>=$A10),--(ConferenceRooms!$F$2:$F$100<=$A10+"00:29"))=0)+0))
Hope everyone had a good day today.
Sam
Last edited by slaro; 01-16-2012 at 08:44 AM.
For #1, assuming you do use Excel 2010 as stated...
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..=IF(COUNTIFS(ConferenceRooms!$E$2:$E$100,LOOKUP(9.99E+300,$B$5:B$5),ConferenceRooms!$H$2:$H$100,B$6,ConferenceRooms!$D$2:$D$100,"Yes",ConferenceRooms!$G$2:$G$100,">="&$A7,ConferenceRooms!$F$2:$F$100,"<="&$A7+"00:29")=0,2,IF(COUNTIFS(ConferenceRooms!$E$2:$E$100,LOOKUP(9.99E+300,$B$5:B$5),ConferenceRooms!$H$2:$H$100,B$6,ConferenceRooms!$G$2:$G$100,">="&$A7,ConferenceRooms!$F$2:$F$100,"<="&$A7+"00:29")=0,1,0))
Microsoft MVP - Excel
Where there is a will there are many ways. Pick One!
Please read the Forum Rules
If you are happy with the results, please add to the contributor's reputation by clicking the reputation icon (star icon) below
Please also mark the thread as Solved once it is solved. Check the FAQ's to see how.
Preferred Charities: Lupus Canada and Sick Kids Foundation.
Feel Free to Donate if you want to, for the assistance you received today.
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
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?
Microsoft MVP - Excel
Where there is a will there are many ways. Pick One!
Please read the Forum Rules
If you are happy with the results, please add to the contributor's reputation by clicking the reputation icon (star icon) below
Please also mark the thread as Solved once it is solved. Check the FAQ's to see how.
Preferred Charities: Lupus Canada and Sick Kids Foundation.
Feel Free to Donate if you want to, for the assistance you received today.
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.
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.=(SUMPRODUCT(--(ConferenceRooms!$E$2:$E$100=LOOKUP(9E+300,$B$5:B$5)),--(ConferenceRooms!$H$2:$H$100=B$6),--(ConferenceRooms!$G$2:$G$100>=$A7),--(ConferenceRooms!$F$2:$F$100<=$A7+"00:29"))=0)+0
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.
I think we just need to change the first condition to check if count is greater than 0, instead of equalling 0.
=IF(COUNTIFS(ConferenceRooms!$E$2:$E$100,LOOKUP(9.99E+300,$B$5:B$5),ConferenceRooms!$H$2:$H$100,B$6,ConferenceRooms!$D$2:$D$100,"Yes",ConferenceRooms!$G$2:$G$100,">="&$A7,ConferenceRooms!$F$2:$F$100,"<="&$A7+"00:29")>0,2,IF(COUNTIFS(ConferenceRooms!$E$2:$E$100,LOOKUP(9.99E+300,$B$5:B$5),ConferenceRooms!$H$2:$H$100,B$6,ConferenceRooms!$G$2:$G$100,">="&$A7,ConferenceRooms!$F$2:$F$100,"<="&$A7+"00:29")=0,1,0))
Microsoft MVP - Excel
Where there is a will there are many ways. Pick One!
Please read the Forum Rules
If you are happy with the results, please add to the contributor's reputation by clicking the reputation icon (star icon) below
Please also mark the thread as Solved once it is solved. Check the FAQ's to see how.
Preferred Charities: Lupus Canada and Sick Kids Foundation.
Feel Free to Donate if you want to, for the assistance you received today.
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.
There are currently 1 users browsing this thread. (0 members and 1 guests)
Bookmarks