+ Reply to Thread
Results 1 to 5 of 5

Trying to get cells to return a range based on two dates

  1. #1
    Registered User
    Join Date
    11-21-2013
    Location
    Missouri
    MS-Off Ver
    Excel 2007
    Posts
    8

    Trying to get cells to return a range based on two dates

    I'm trying to determine if a target date was met. Cell A2 is the target date and cell B2 is the actual completion date.

    I would like the following ranges to return based on the actual completion date vs target date.

    A: Early
    B: On Time
    C: 1-3 Days
    D: 4-6 Days
    E: 7-9 Days
    F: 10-13 Days
    G: 14+ Days

    I don't know what formula to imput to return the result I'm looking for as I'm pretty novice to excel.

    I am able to get Early and On time to retun with the following =IF(ISBLANK(B2)," ",IF(B2<a2,"A: Early" ,IF(B2=A2,"B: On Time")) but don't know how to get the rest of the results to return if the actual completion date falls in those categories.

    Any help would be greatly appreciated.

  2. #2
    Forum Guru benishiryo's Avatar
    Join Date
    03-25-2011
    Location
    Singapore
    MS-Off Ver
    Excel 2013
    Posts
    5,147

    Re: Trying to get cells to return a range based on two dates

    welcome to the forum, redjayhawk11. say you have these in E1:E6
    0
    1
    4
    7
    10
    14

    and these in F1:F6
    B: On Time
    C: 1-3 Days
    D: 4-6 Days
    E: 7-9 Days
    F: 10-13 Days
    G: 14+ Days

    so try:
    =IF(A2="","",IF(B2<A2,"A: Early",LOOKUP(B2-A2,$E$1:$F$6)))

    if you don't wish to have that table, then:
    =IF(A2="","",IF(B2<A2,"A: Early",LOOKUP(B2-A2,{0,"B: On Time";1,"C: 1-3 Days";4,"D: 4-6 Days";7,"E: 7-9 Days";10,"F: 10-13 Days";14,"G: 14+ Days"})))

    Thanks, if you have clicked on the * and added our rep.

    If you're satisfied with the answer, click Thread Tools above your first post, select "Mark your thread as Solved".

    "Contentment is not the fulfillment of what you want, but the realization of what you already have."


    Tips & Tutorials I Compiled | How to Get Quick & Good Answers

  3. #3
    Registered User
    Join Date
    11-21-2013
    Location
    Missouri
    MS-Off Ver
    Excel 2007
    Posts
    8

    Re: Trying to get cells to return a range based on two dates

    Thank you Benishiryo!

    I went with the second option to avoid having to insert the table. If you have a moment and are able to explain the formula that would be a tremendous help as I'm trying to soak up as much knowledge as possible.

  4. #4
    Forum Guru benishiryo's Avatar
    Join Date
    03-25-2011
    Location
    Singapore
    MS-Off Ver
    Excel 2013
    Posts
    5,147

    Re: Trying to get cells to return a range based on two dates

    you're very welcome.

    =IF(A2="","",IF(B2<A2,"A: Early",
    this is the easier part. if A2 is blank, show a blank. if B2 is lesser than A2, show it as "A: Early".

    LOOKUP(B2-A2,$E$1:$F$6)))
    LOOKUP works mostly with a sorted list of ascending order. that's why i had my values in E1:E6 from 0-14. B2-A2 would give me the difference. the LOOKUP formula then looks for a value that is greater than or equals to it from the bottom up. so if the difference is 8. it looks at 14. not greater than or equal to it. so it compares with 10. fails again. compares with 7. this time, it is greater than it despite not being equal to it. it will then return the value of the next column i did; E: 7-9 Days

    If that takes care of your original question, please select Thread Tools from the menu link above and mark this thread as SOLVED. Thanks.

  5. #5
    Registered User
    Join Date
    11-21-2013
    Location
    Missouri
    MS-Off Ver
    Excel 2007
    Posts
    8

    Re: Trying to get cells to return a range based on two dates

    Thanks for explaining!!

+ 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. Return a value in a range of cells based on a previous formula
    By gori1084 in forum Excel Formulas & Functions
    Replies: 1
    Last Post: 03-30-2013, 11:14 PM
  2. [SOLVED] Return a variable based on a selection between dates and times in a range
    By Mr. H2 in forum Excel Formulas & Functions
    Replies: 3
    Last Post: 02-20-2013, 10:22 AM
  3. [SOLVED] Conditional formatting based on dates in a range of cells
    By pmerobertson in forum Excel General
    Replies: 8
    Last Post: 01-10-2013, 12:50 PM
  4. Colour a range of cells based on two dates
    By Gooford in forum Excel General
    Replies: 6
    Last Post: 09-27-2009, 01:19 PM
  5. return based on range of dates
    By Matt in forum Excel Formulas & Functions
    Replies: 6
    Last Post: 02-15-2006, 04:40 PM

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.6.0 RC 1