+ Reply to Thread
Results 1 to 16 of 16

Calculating Weeks, Weekday nights and Weekend nights

  1. #1
    Registered User
    Join Date
    10-20-2010
    Location
    San Francisco, California
    MS-Off Ver
    Excel 2010
    Posts
    13

    Calculating Weeks, Weekday nights and Weekend nights

    Hello,
    I'm developing a register for a hostel, given two set of dates (check-in and check-out)
    i have to calculate the number of weekday nights(Sun-Thu) and weekend Nights (Fri-Sat),i'm really new to excel and i would appreciate any help in doing this.

    Thanks in advance,
    Av
    Last edited by bngguy; 10-26-2010 at 01:20 PM.

  2. #2
    Forum Moderator zbor's Avatar
    Join Date
    02-10-2009
    Location
    Croatia
    MS-Off Ver
    365 ProPlus
    Posts
    15,602

    Re: Calculating wkday nights and wkend nights

    Please, upload an example workbook with desired inpt and output.

  3. #3
    Registered User
    Join Date
    10-20-2010
    Location
    San Francisco, California
    MS-Off Ver
    Excel 2010
    Posts
    13

    Re: Calculating wkday nights and wkend nights

    Quote Originally Posted by zbor View Post
    Please, upload an example workbook with desired inpt and output.
    I have uploaded a demo, please let me know if this is right.
    Attached Files Attached Files
    Last edited by bngguy; 10-21-2010 at 02:14 AM.

  4. #4
    Forum Guru DonkeyOte's Avatar
    Join Date
    10-22-2008
    Location
    Northumberland, UK
    MS-Off Ver
    O365
    Posts
    21,531

    Re: Calculating wkday nights and wkend nights

    From what I can tell the Demo works, no ?

    (NETWORKDAYS.INTL is exclusive to XL2010 and beyond)

  5. #5
    Registered User
    Join Date
    10-20-2010
    Location
    San Francisco, California
    MS-Off Ver
    Excel 2010
    Posts
    13

    Re: Calculating wkday nights and wkend nights

    Quote Originally Posted by DonkeyOte View Post
    From what I can tell the Demo works, no ?

    (NETWORKDAYS.INTL is exclusive to XL2010 and beyond)
    Ok but you get an idea of what i'm trying to do, i have a check-in date and check-out date, using these two dates i need to find out the number of weekday nights(SUN-THU) and number of weekend Nights(FRI-SAT).

  6. #6
    Forum Guru DonkeyOte's Avatar
    Join Date
    10-22-2008
    Location
    Northumberland, UK
    MS-Off Ver
    O365
    Posts
    21,531

    Re: Calculating wkday nights and wkend nights

    Perhaps you could explain how the sample you posted isn't doing what you want because to me it seems to do exactly as you requested.

  7. #7
    Registered User
    Join Date
    10-20-2010
    Location
    San Francisco, California
    MS-Off Ver
    Excel 2010
    Posts
    13

    Re: Calculating wkday nights and wkend nights

    Quote Originally Posted by DonkeyOte View Post
    Perhaps you could explain how the sample you posted isn't doing what you want because to me it seems to do exactly as you requested.
    Lets say somebody checks in on Sunday morning and checks out on Friday Morning,the number of weekday nights should be 5 and weekend nights should be zero.
    With the formula i used i get number of weekday nights to be 4 and number of weekend nights to be 1.

  8. #8
    Forum Guru DonkeyOte's Avatar
    Join Date
    10-22-2008
    Location
    Northumberland, UK
    MS-Off Ver
    O365
    Posts
    21,531

    Re: Calculating wkday nights and wkend nights

    Ah, sorry - yes I see !

    Please Login or Register  to view this content.
    the above discounts check out date - the MAX should prove superfluous but you never know...

  9. #9
    Registered User
    Join Date
    10-20-2010
    Location
    San Francisco, California
    MS-Off Ver
    Excel 2010
    Posts
    13

    Re: Calculating wkday nights and wkend nights

    the above discounts check out date - the MAX should prove superfluous but you never know...[/QUOTE]

    Thanks that works well, i have another question though, is it possible to set check in and check out dates to Today() as default.
    Last edited by DonkeyOte; 10-26-2010 at 02:13 AM. Reason: unnec. quote removed

  10. #10
    Registered User
    Join Date
    10-20-2010
    Location
    San Francisco, California
    MS-Off Ver
    Excel 2010
    Posts
    13

    Re: Calculating number of weeks, weekday nights & weekend nights

    Thanks that works well, i have to add another column that computes the number of weeks between 2 dates.Please See Demo.
    Attached Files Attached Files
    Last edited by DonkeyOte; 10-26-2010 at 02:14 AM. Reason: unnec. quote removed

  11. #11
    Forum Guru DonkeyOte's Avatar
    Join Date
    10-22-2008
    Location
    Northumberland, UK
    MS-Off Ver
    O365
    Posts
    21,531

    Re: Calculating Weeks, Weekday nights and Weekend nights

    No need to quote prior posts in their entirety in your reply - this just clutters the board.

    I confess that again I am a little confused by the example

    Check-In 7-Oct
    Check-Out 28-Oct
    is 21 nights so why is the expected results anything other than 3 weeks ?

    Were

    Check-Out 27-Oct
    then I concur with 2 weeks, 4 weekday and 2 weekend:

    Please Login or Register  to view this content.

  12. #12
    Registered User
    Join Date
    10-20-2010
    Location
    San Francisco, California
    MS-Off Ver
    Excel 2010
    Posts
    13

    Re: Calculating Weeks, Weekday nights and Weekend nights

    Thanks i had already solved that one before you posted,now my last task is to have a message popup whenever the stay is exceeded by 3 weeks.I would really appreciate if you could help me out with this one:

    If ((F2>3) OR ((F2 = 3) AND ((E2 >1) OR (D2>1)))) then
    MsgBox (" Stay Cannot Exceed 3 Weeks !!! ")
    End if

    Except F2,E2,D2 are all columns with 54 rows, so when the user enters the check-in date and check-out date, D2 , E2 , F2 are computed and the macro should immediately alert the user if the above conditions are met.I'm really new to VBA, if you could code the macro for me that would be great.

    Thanks
    Last edited by bngguy; 10-26-2010 at 03:32 AM.

  13. #13
    Forum Guru DonkeyOte's Avatar
    Join Date
    10-22-2008
    Location
    Northumberland, UK
    MS-Off Ver
    O365
    Posts
    21,531

    Re: Calculating Weeks, Weekday nights and Weekend nights

    Quote Originally Posted by bngguy
    Thanks i had already solved that one before you posted,
    In which case please have the courtesy to post to that effect rather than have people waste their freely donated time resolving a now obsolete problem.

    Regards your three week requirement - in the context of the thread this is an entirely new requirement and as such should be posted to a new dedicated thread.

  14. #14
    Registered User
    Join Date
    10-20-2010
    Location
    San Francisco, California
    MS-Off Ver
    Excel 2010
    Posts
    13

    Re: Calculating Weeks, Weekday nights and Weekend nights

    I'm sorry if i offended you, i will post a new thread for the 3 week requirement.

  15. #15
    Registered User
    Join Date
    10-20-2010
    Location
    San Francisco, California
    MS-Off Ver
    Excel 2010
    Posts
    13

    Macro for Message Popup

    Hello,
    I'm developing a register for a hostel, given two set of dates (check-in and check-out), i need to have a message popup whenever the stay is exceeded by 3 weeks.I would really appreciate if you could help me out with this one:

    Please See DEMO File.

    If ((F2>3) OR ((F2 = 3) AND ((E2 >1) OR (D2>1)))) then
    MsgBox (" Stay Cannot Exceed 3 Weeks !!! ")
    End if

    Except F2,E2,D2 are all columns with 54 rows, so when the user enters the check-in date and check-out date, D2 , E2 , F2 are computed and the macro should immediately alert the user if the above conditions are met.I'm really new to VBA, if you could code the macro for me that would be great.

    Thanks
    AV
    Attached Files Attached Files

  16. #16
    Forum Guru DonkeyOte's Avatar
    Join Date
    10-22-2008
    Location
    Northumberland, UK
    MS-Off Ver
    O365
    Posts
    21,531

    Re: Calculating Weeks, Weekday nights and Weekend nights

    @AV, as already mentioned this latest question belongs in an entirely new thread

    edit: I see you have done this: http://www.excelforum.com/excel-prog...age-popup.html

+ 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