+ Reply to Thread
Results 1 to 9 of 9

Thread: Populate date based on a date in another cell

  1. #1
    Registered User
    Join Date
    01-29-2011
    Location
    Boca Raton, Florida
    MS-Off Ver
    Excel 2003/2010
    Posts
    28

    Question Populate date based on a date in another cell

    Hello,

    Newby here.

    I hope someone can help me with the following scenario:

    I have a date in cell "A1", a formula in cell "B1" that populates the day of the week based on the date in cell "A1". What I need is a formula for cell "C1" that will populate the date of the upcoming FRIDAY based on the date in cell "A1".

    What ever the date in cell "A1", the date in cell "C1" needs to always display the date of the next/ upcoming Friday. Is this possible?

    Anthony
    Last edited by ascottbag; 01-29-2011 at 03:32 PM. Reason: Needed to add an icon so others know I have a question

  2. #2
    Valued Forum Contributor MarvinP's Avatar
    Join Date
    07-23-2010
    Location
    Seattle, WA
    MS-Off Ver
    Excel 2010
    Posts
    5,285

    Re: How do I populate a specific date based on a date in another cell

    Hi ascottbag and welcome to the forum

    YES it is possible. Try this.

    C1:  =A1-WEEKDAY(A1)+IF(WEEKDAY(A1)<6,6,13)
    Make sure your date cells are formatted as dates. Test it to make sure.
    One test is worth a thousand opinions.
    Click the * below to say thanks.

  3. #3
    Registered User
    Join Date
    01-29-2011
    Location
    Boca Raton, Florida
    MS-Off Ver
    Excel 2003/2010
    Posts
    28

    Re: How do I populate a specific date based on a date in another cell

    Thanks Marvin! I will try out the formula first thing tomorrow! The wife is getting restless for me to pay some attention to her.

    Will let you know tomorrow if your solution worked for me.

    Again, THANKS!

  4. #4
    Forum Moderator daddylonglegs's Avatar
    Join Date
    01-14-2006
    Location
    England
    MS-Off Ver
    2007
    Posts
    10,056

    Re: Populate date based on a date in another cell

    What should C1 show if A1 is a Friday? Assuming that C1 should show the same date as A1 in that situation try

    =A1-WEEKDAY(A1+1)+7

    or if you want to see the following Friday if A1 is Friday change to

    =A1-WEEKDAY(A1+2)+8
    Audere est facere

  5. #5
    Valued Forum Contributor MarvinP's Avatar
    Join Date
    07-23-2010
    Location
    Seattle, WA
    MS-Off Ver
    Excel 2010
    Posts
    5,285

    Re: Populate date based on a date in another cell

    My formula was the next Friday if the date in A1 was a Friday as per
    needs to always display the date of the next/ upcoming Friday
    Here is another formula that will product these results.
    =A1-WEEKDAY(A1,15)+8
    I find interesting how many ways/methods can be used to arrive at a date no more than 7 days away. I'm almost ready to write a User Defined Function to return it. OK - here it is,
    Function NextFriday(argDate As Range)
    
    Dim dblDate As Double
        dblDate = CDbl(argDate)
        
        dblDate = dblDate + 1
        
        Do Until WorksheetFunction.Weekday(dblDate) = 6
            dblDate = dblDate + 1
        Loop
        
        NextFriday = CDate(dblDate)
    End Function
    I like NBVC's Signature which says: When there's a will there's many ways - Pick One
    One test is worth a thousand opinions.
    Click the * below to say thanks.

  6. #6
    Forum Moderator daddylonglegs's Avatar
    Join Date
    01-14-2006
    Location
    England
    MS-Off Ver
    2007
    Posts
    10,056

    Re: Populate date based on a date in another cell

    Quote Originally Posted by MarvinP View Post
    =A1-WEEKDAY(A1,15)+8
    Did you try that one, Marvin
    Audere est facere

  7. #7
    Valued Forum Contributor MarvinP's Avatar
    Join Date
    07-23-2010
    Location
    Seattle, WA
    MS-Off Ver
    Excel 2010
    Posts
    5,285

    Re: Populate date based on a date in another cell

    Yep! Didn't it work for you?

    One Test....

    See attached for what I used...

    ALTHOUGH
    http://office.microsoft.com/en-us/ex...005209336.aspx - was limited in 2003?
    http://office.microsoft.com/en-us/ex...010062298.aspx in 2007
    http://excelsemipro.com/2010/09/the-...tion-in-excel/ in 2010

    I see my assumption 2010 is the standard may lead to problems.

    I knew you wouldn't ask if it worked for you. Thanks for the correction.
    Attached Files Attached Files
    Last edited by MarvinP; 01-30-2011 at 01:13 PM.
    One test is worth a thousand opinions.
    Click the * below to say thanks.

  8. #8
    Registered User
    Join Date
    01-29-2011
    Location
    Boca Raton, Florida
    MS-Off Ver
    Excel 2003/2010
    Posts
    28

    Re: Populate date based on a date in another cell

    I hope I'm sending this reply correctly.

    Thank you gentlemen! And I apologize for not making my issue clear that should the date in A1 be a Friday, the date in C1 should be the same date as A1, other wise, C1 should always be the Friday following the date in A1.

    The formula, =A1-WEEKDAY(A1+1)+7, worked exactly as I needed!

    Again, thank you gentlemen for your help!

  9. #9
    Forum Moderator daddylonglegs's Avatar
    Join Date
    01-14-2006
    Location
    England
    MS-Off Ver
    2007
    Posts
    10,056

    Re: Populate date based on a date in another cell

    Quote Originally Posted by MarvinP View Post
    Yep! Didn't it work for you?
    D'oh! Apologies Marvin

    ......Excel 2010 only, though.....
    Audere est facere

+ Reply to Thread

Thread Information

Users Browsing this Thread

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

Tags for this Thread

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.2.0