+ Reply to Thread
Results 1 to 10 of 10

Code for date

  1. #1
    Forum Contributor
    Join Date
    12-18-2015
    Location
    scotland
    MS-Off Ver
    MS office 365 business
    Posts
    187

    Question Code for date

    Hi All

    I'm using this spreadsheet at work for budget monitoring however I want to be able to look at whatever sheet and know if the order has been GRN'd this is what goes in when the order is received, if the order has not been GRN'd within 14 days I would like the date cell to turn red.

    Can this be done through conditional formatting or is a piece of code required.

    Thanks
    Toddp2
    [[ATTACH]53794test CE.xlsx8[/ATTACH]

    Use Test CE file instead of committed expenditure file
    thanks
    Attached Files Attached Files
    Last edited by toddp2; 09-13-2017 at 02:58 PM.

  2. #2
    Forum Expert Kenneth Hobson's Avatar
    Join Date
    02-05-2007
    Location
    Tecumseh, OK
    MS-Off Ver
    Office 365, Win10Home
    Posts
    2,573

    Re: Code for date

    I am not sure if you wanted it red if not GRN or not. CF formula rule:
    =OR($H10<>"GRN",AND($H10="GRN",NOW()-$E10>14))

  3. #3
    Forum Contributor
    Join Date
    12-18-2015
    Location
    scotland
    MS-Off Ver
    MS office 365 business
    Posts
    187

    Re: Code for date

    Hi Kenneth

    That looks the part, its the date cell I want in red and would the 14 represent 14 calendar days

    Toddp2

    Thought I knew how this works but I don't where on the sheet should apply the formula
    Last edited by toddp2; 09-13-2017 at 03:39 PM.

  4. #4
    Forum Expert Kenneth Hobson's Avatar
    Join Date
    02-05-2007
    Location
    Tecumseh, OK
    MS-Off Ver
    Office 365, Win10Home
    Posts
    2,573

    Re: Code for date

    Put it in your Date cell row 14 (E10) and after the rule is entered, select all the rows in that column you want the rule to apply. Note how I use $ just for the columns, not the rows.

    You can put that formula anywhere to evaluate the rule for E10. The rule should evaluate to True or False. If True, the conditions are met.

    Yes, 14 is the difference from Now() to the date in E10. Change to suit.

  5. #5
    Forum Contributor
    Join Date
    12-18-2015
    Location
    scotland
    MS-Off Ver
    MS office 365 business
    Posts
    187

    Re: Code for date

    Thanks for your help

  6. #6
    Forum Contributor
    Join Date
    12-18-2015
    Location
    scotland
    MS-Off Ver
    MS office 365 business
    Posts
    187

    Re: Code for date

    Hi Guys

    Could someone add this formula to the attached sheet Kenneth explained it but I'm not getting it, the plan is that after 14 days or whatever th edate cell will change to red as a to hightlight the order hasn't been GRN'd


    CE Test.xlsx

    =OR($H10<>"GRN",AND($H10="GRN",NOW()-$E10>14))
    Last edited by toddp2; 09-15-2017 at 04:43 AM.

  7. #7
    Forum Moderator - RIP Richard Buttrey's Avatar
    Join Date
    01-14-2008
    Location
    Stockton Heath, Cheshire, UK
    MS-Off Ver
    Office 365, Excel for Windows 2010 & Excel for Mac
    Posts
    29,464

    Re: Code for date

    It's a conditional format formula, not a formula that goes in a cell.

    Home...Conditional Formatting, Manage Rules, New Rule, Use a formula option and enter the formula.
    Richard Buttrey

    RIP - d. 06/10/2022

    If any of the responses have helped then please consider rating them by clicking the small star icon below the post.

  8. #8
    Administrator 6StringJazzer's Avatar
    Join Date
    01-27-2010
    Location
    Tysons Corner, VA, USA
    MS-Off Ver
    MS 365 Family 64-bit 2404
    Posts
    24,870

    Re: Code for date

    " the plan is that after 14 days or whatever th edate cell will change to red as a to hightlight the order hasn't been GRN'd"

    Could be clearer.

    Here is what I did. If it's not what you want you will have to explain further.

    Conditional formatting will highlight the cells in the Date column if the GRN column is blank and the date is more than 14 days old. (This is a bit different than what Kennth gave you.) The formula is

    Formula: copy to clipboard
    Please Login or Register  to view this content.
    Attached Files Attached Files
    Jeff
    | | |會 |會 |會 |會 | |:| | |會 |會
    Read the rules
    Use code tags to [code]enclose your code![/code]

  9. #9
    Forum Contributor
    Join Date
    12-18-2015
    Location
    scotland
    MS-Off Ver
    MS office 365 business
    Posts
    187

    Re: Code for date

    Hi 6StringJazzer

    That's bang on the money, I will provide clearer explanation within my posts in the future.

    Thanks
    Toddp2

  10. #10
    Administrator 6StringJazzer's Avatar
    Join Date
    01-27-2010
    Location
    Tysons Corner, VA, USA
    MS-Off Ver
    MS 365 Family 64-bit 2404
    Posts
    24,870

    Re: Code for date

    Quote Originally Posted by toddp2 View Post
    I will provide clearer explanation within my posts in the future.
    Just for the record here is what I could not tell for sure:

    14 days or whatever
    Well, I just used 14 days. Excel does not yet have a WHATEVER function




    the order hasn't been GRN'd
    I don't know what that meant or how to tell. I took a guess that if an order had been GRN'd that something would appear in the GRN column. So I assumed if the column is blank, it has not been GRN'd. (I could also imagine other situations where various values could appear in that column meaning various things.)

+ 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. Need vba code to change date&time stamp as date format dd-mmm-yy in A:A rng
    By breadwinner in forum Excel Programming / VBA / Macros
    Replies: 2
    Last Post: 09-03-2014, 06:08 AM
  2. Replies: 2
    Last Post: 10-06-2013, 02:03 PM
  3. [SOLVED] vba code to find Duplicate Values and Newest date(Max) date in the Corresponding Column(ce
    By Pradu in forum Excel Programming / VBA / Macros
    Replies: 2
    Last Post: 09-10-2013, 05:20 AM
  4. [SOLVED] VBA: Read date and paste the date info on the correct cell. Analyse code please.
    By ropbasuel in forum Excel Programming / VBA / Macros
    Replies: 9
    Last Post: 05-10-2013, 05:32 AM
  5. Formulating Date cells to auto color code based on Date
    By darren.capps in forum Excel Formulas & Functions
    Replies: 8
    Last Post: 04-23-2013, 02:08 PM
  6. Color Code Actual Date versus Due Date ( Red, Yellow, Green )
    By Bfisher74 in forum Excel Formulas & Functions
    Replies: 2
    Last Post: 01-28-2013, 10:10 AM
  7. Replies: 5
    Last Post: 02-02-2010, 05:01 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