+ Reply to Thread
Results 1 to 7 of 7

Find week days within the date range and return number

  1. #1
    Registered User
    Join Date
    12-01-2014
    Location
    Bangkok, Thailand
    MS-Off Ver
    2007, 2010
    Posts
    4

    Find week days within the date range and return number

    Hi! Is there anyway I can get this result?

    A1 = Check-in Date
    B1 = Check-out Date (isn't counted)
    Room rate on Sun, Mon, Tue, Wed = 100
    Room rate on Thu, Fri, Sat = 110
    C1 = Sum of the Room rates

    For example
    5/12/2014 Fri 110
    6/12/2014 Sat 110
    7/12/2014 Sun 100
    8/12/2014 Mon 100
    9/12/2014
    Sum 420

    Display in the worksheet
    A1 B1 C1
    5/12/2014 9/12/2014 420

    Sorry, I don't know how to explain better than this.

  2. #2
    Forum Guru
    Join Date
    05-24-2011
    Location
    India
    MS-Off Ver
    Office 2021
    Posts
    2,237

    Re: Find week days within the date range and return number

    Hello Smith,

    Try this in C1

    =SUMPRODUCT(LOOKUP(WEEKDAY(ROW(INDEX(A:A,A1):INDEX(A:A,B1-1))),{1,5},{100,110}))
    Regards,
    Haseeb Avarakkan

    __________________________________
    "Feedback is the breakfast of champions"

  3. #3
    Valued Forum Contributor
    Join Date
    07-07-2014
    Location
    Washington DC
    MS-Off Ver
    2007
    Posts
    1,047

    Re: Find week days within the date range and return number

    Should be simple enough, but the format of the data is going to be the main issue. Can you upload a sanitized sample file showing how the data is arranged normally and what you'd like it to look like when you're done?

  4. #4
    Forum Expert Tony Valko's Avatar
    Join Date
    12-31-2011
    Location
    Pittsburgh
    MS-Off Ver
    2002, 2007:2013
    Posts
    18,890

    Re: Find week days within the date range and return number

    As long as the Check-in and Check-out are different days...

    Based on Haseeb's idea.

    Array entered**:

    =SUM(IF(WEEKDAY(ROW(INDEX(A:A,A1):INDEX(A:A,B1-1)))>4,110,100))

    ** array formulas need to be entered using the key
    combination of CTRL,SHIFT,ENTER (not just ENTER).
    Hold down both the CTRL key and the SHIFT key
    then hit ENTER.
    Biff
    Microsoft MVP Excel
    Keep It Simple Stupid

    Let's Go Pens. We Want The Cup.

  5. #5
    Registered User
    Join Date
    12-01-2014
    Location
    Bangkok, Thailand
    MS-Off Ver
    2007, 2010
    Posts
    4

    Re: Find week days within the date range and return number

    Thank you Haseeb A! I have never used SUMPRODUCT and LOOKUP before. It works great, thank you so much!!

  6. #6
    Registered User
    Join Date
    12-01-2014
    Location
    Bangkok, Thailand
    MS-Off Ver
    2007, 2010
    Posts
    4

    Re: Find week days within the date range and return number

    Thank you Tony! Now I can play with your and Haseeb's formulas in many of my reports. Very appreciate your helps.

    Problem solved!!

  7. #7
    Forum Expert Tony Valko's Avatar
    Join Date
    12-31-2011
    Location
    Pittsburgh
    MS-Off Ver
    2002, 2007:2013
    Posts
    18,890

    Re: Find week days within the date range and return number

    You're welcome. We appreciate the feedback!

    If your question has been solved please mark the thread as being solved.

    In the menu bar above the very first post select Thread Tools, then select Mark this thread as solved.

+ Reply to Thread

Thread Information

Users Browsing this Thread

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

Similar Threads

  1. [SOLVED] Find yesterdays date in range and return row number to be used in offset
    By graphicgoose in forum Excel Programming / VBA / Macros
    Replies: 6
    Last Post: 07-13-2014, 09:20 PM
  2. [SOLVED] Find first date of the month in range and return column number
    By jben86 in forum Excel Programming / VBA / Macros
    Replies: 5
    Last Post: 09-06-2013, 08:30 PM
  3. [SOLVED] Find number of days greater than zero between date range.
    By Mayzach in forum Excel Formulas & Functions
    Replies: 9
    Last Post: 08-30-2013, 02:17 PM
  4. [SOLVED] Number of Days Between Dates but if no Date go to next and return # of Days
    By Bikeman in forum Excel Formulas & Functions
    Replies: 3
    Last Post: 12-14-2012, 12:02 PM
  5. Separating days by Year/Week in a date range :)
    By scotinexcile in forum Excel Formulas & Functions
    Replies: 2
    Last Post: 08-21-2012, 09:26 PM

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