+ Reply to Thread
Results 1 to 7 of 7

Assign a week commencing date to a random date

  1. #1
    Banned User!
    Join Date
    09-26-2015
    Location
    Manchester
    MS-Off Ver
    2013
    Posts
    218

    Assign a week commencing date to a random date

    Hi All,

    With reference to the attached, on tab 2 I have a list of random dates in column G.

    On tab 1, I have a horizontal array of week commencing dates.

    In column F of tab 2, I need a formula that assigns a week commencing date to the random date.

    The rule is that if the random date in column G is equal to or greater than a given week commencing date, but less than the next week commencing date, it should be assigned the former date.

    Thanks in advance.
    Attached Files Attached Files

  2. #2
    Forum Expert
    Join Date
    05-05-2015
    Location
    UK
    MS-Off Ver
    Microsoft Excel for Microsoft 365 MSO (Version 2402 Build 16.0.17328.20068) 64-bit
    Posts
    28,206

    Re: Assign a week commencing date to a random date

    Try

    =MATCH(G7,'Tab 1'!$D$7:$BD$7,1)

  3. #3
    Valued Forum Contributor Neil_'s Avatar
    Join Date
    04-19-2013
    Location
    Yorkshire
    MS-Off Ver
    Office 365 Enterprise E3 2013 / 2016
    Posts
    479

    Re: Assign a week commencing date to a random date

    Hi, your week commencing day seems to be Friday. If it is always to be Friday, you don't need tab1

    Please Login or Register  to view this content.
    Attached Images Attached Images
    Last edited by Neil_; 09-28-2016 at 02:29 PM.
    Frob first, tweak later

  4. #4
    Banned User!
    Join Date
    09-26-2015
    Location
    Manchester
    MS-Off Ver
    2013
    Posts
    218

    Re: Assign a week commencing date to a random date

    Hi John,

    This isn't generating the correct information. If I generate the formula in date format, the month and year always show as 01 and 1900 respectively, although the day does change (seemingly referencing the number of the week in the array, rather than anything else).

  5. #5
    Forum Expert
    Join Date
    05-05-2015
    Location
    UK
    MS-Off Ver
    Microsoft Excel for Microsoft 365 MSO (Version 2402 Build 16.0.17328.20068) 64-bit
    Posts
    28,206

    Re: Assign a week commencing date to a random date

    If you want date (rather than week no 1,2 ...))

    =INDEX('Tab 1'!$D$7:$BD$7,MATCH(G7,'Tab 1'!$D$7:$BD$7,1))

    or use Neil's answer

  6. #6
    Banned User!
    Join Date
    09-26-2015
    Location
    Manchester
    MS-Off Ver
    2013
    Posts
    218

    Re: Assign a week commencing date to a random date

    Thanks Neil that worked perfectly. I had forgotten about this function actually.

    My week commencing dates are always Mondays - in the upload I had simply started with the first day of the year, so in my real version I have used the return type 1 instead of 15 and changed my array accordingly.

    Thanks again

  7. #7
    Banned User!
    Join Date
    09-26-2015
    Location
    Manchester
    MS-Off Ver
    2013
    Posts
    218

    Re: Assign a week commencing date to a random date

    Thanks again John. This second solution generates the desired result and as it uses the first array as the reference, ensures consistency between the two tabs even when changes are made, so think I'll use this one.

    Thank you both Neil and John.

+ 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. Replies: 13
    Last Post: 10-10-2014, 06:50 AM
  2. [SOLVED] Work out week commencing date
    By Bunny Screen in forum Excel Formulas & Functions
    Replies: 5
    Last Post: 03-20-2014, 01:12 PM
  3. [SOLVED] Week Commencing
    By Phil Walters in forum Excel General
    Replies: 3
    Last Post: 09-04-2012, 06:39 AM
  4. Generating week commencing date for 52weeks.
    By sritantry in forum Excel Programming / VBA / Macros
    Replies: 4
    Last Post: 06-17-2012, 01:36 AM
  5. Converting a week number into a week commencing
    By wetbean in forum Excel General
    Replies: 9
    Last Post: 12-21-2011, 06:18 PM
  6. Automatic week commencing date
    By loz786 in forum Excel Formulas & Functions
    Replies: 3
    Last Post: 12-15-2011, 03:57 PM
  7. Week commencing Date
    By amarpabari in forum Excel General
    Replies: 1
    Last Post: 07-06-2011, 04:53 AM

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