+ Reply to Thread
Results 1 to 7 of 7

Determining values based on the 'time' given in two cells

Hybrid View

  1. #1
    Registered User
    Join Date
    07-12-2015
    Location
    liverpool, england
    MS-Off Ver
    Professional plus 2010
    Posts
    6

    Determining values based on the 'time' given in two cells

    Hi,

    This might be completely impossible, but thought I'd ask anyway. Basically, I have three columns like so:

    A B C

    "Sat May 20 11:39:52 GMT+01:00 2017" "Sat May 20 11:42:41 GMT+01:00 2017"
    "Sat May 20 15:04:35 GMT+01:00 2017" "Sat May 20 15:36:57 GMT+01:00 2017"
    "Sat May 20 16:44:33 GMT+01:00 2017" "Sat May 20 16:46:07 GMT+01:00 2017"
    "Sat May 20 21:47:49 GMT+01:00 2017" "Sat May 20 18:41:17 GMT+01:00 2017"


    What I want to determine is whether the time in column B corresponds to within 30 minutes of the time in column A. If it does, I want the corresponding cell in column C to say 'Yes' or 'no' if it doesn't (or words to that effect). So in the first 3 rows given here, C should say 'Yes', and in the 4th row, C should = 'no'.

    Is there a way to do this ?

    Thanks :-)

  2. #2
    Forum Expert
    Join Date
    03-23-2004
    Location
    London, England
    MS-Off Ver
    Excel 2019
    Posts
    7,065

    Re: Determining values based on the 'time' given in two cells

    Row 2 should be "NO" since 15:04:35+30 minutes gives 15:34:35
    15:36:57 is NOT within 30 minutes of 15:04
    Regards
    Special-K

    Ensure you describe your problem clearly, I have little time available to solve these problems and do not appreciate numerous changes to them.

  3. #3
    Forum Guru Pete_UK's Avatar
    Join Date
    12-31-2011
    Location
    Warrington, England
    MS-Off Ver
    Office 2019 (still learning)
    Posts
    24,853

    Re: Determining values based on the 'time' given in two cells

    Shouldn't the second one be "no" also, as the time difference is more than 30 minutes?

    Pete

  4. #4
    Forum Guru Pete_UK's Avatar
    Join Date
    12-31-2011
    Location
    Warrington, England
    MS-Off Ver
    Office 2019 (still learning)
    Posts
    24,853

    Re: Determining values based on the 'time' given in two cells

    If you agree to my question, then you can use this in C2:

    =IF(ABS(DATEVALUE(MID(B2,9,3)&MID(B2,5,3)&RIGHT(B2,4)) + VALUE(MID(B2,12,8)) - (DATEVALUE(MID(A2,9,3)&MID(A2,5,3)&RIGHT(A2,4)) + VALUE(MID(A2,12,8))))<=30/60/24,"yes","no")

    and copy down. Note that I have not taken into account the GMT+01, as this was the same for all your examples.

    Hope this helps.

    Pete

  5. #5
    Forum Expert
    Join Date
    03-23-2004
    Location
    London, England
    MS-Off Ver
    Excel 2019
    Posts
    7,065

    Re: Determining values based on the 'time' given in two cells

    Ugh! This is so horribly long but as Ive spent the time on it...

    =IF(AND(((MID(B1,9,2)&" "&MID(B1,5,3)&" "&RIGHT(B1,4)&" "&MID(B1,12,8))+0)>=((MID(A1,9,2)&" "&MID(A1,5,3)&" "&RIGHT(A1,4)&" "&MID(A1,12,8))+0),((MID(B1,9,2)&" "&MID(B1,5,3)&" "&RIGHT(B1,4)&" "&MID(B1,12,8))+0)<=((MID(A1,9,2)&" "&MID(A1,5,3)&" "&RIGHT(A1,4)&" "&MID(A1,12,8))+0)+TIMEVALUE("00:30:00")),"Y","N")

    UPDATE: Actually, this only allows for 30 minutes AFTER the start time, Pete's solution allows 30 minutes before the start time so his may be the correct answer.

  6. #6
    Registered User
    Join Date
    07-12-2015
    Location
    liverpool, england
    MS-Off Ver
    Professional plus 2010
    Posts
    6

    Re: Determining values based on the 'time' given in two cells

    Wow you people are clever - thank you! (+ yes, row 2 should have been 'no', sorry!)

  7. #7
    Forum Guru Pete_UK's Avatar
    Join Date
    12-31-2011
    Location
    Warrington, England
    MS-Off Ver
    Office 2019 (still learning)
    Posts
    24,853

    Re: Determining values based on the 'time' given in two cells

    Glad to help.

    If that takes care of your original question, please take a moment to select Thread Tools from the menu above and to the right of your first post and mark this thread as SOLVED.

    Also, since you are relatively new to the forum, you might like to know that you can directly thank those who have helped you by clicking on the small "star" icon located in the lower left corner of a post that you have found to be helpful (not just in this thread - for any post that has helped you). This also adds to the reputation of the poster (the small green bars in the poster's profile).

    Pete

+ 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. Determining values based on the 'time' given in two cells
    By helzbelz1984 in forum Excel Formulas & Functions
    Replies: 1
    Last Post: 06-05-2017, 12:19 PM
  2. determining percentile rank based on fixed quartile values
    By cartman88 in forum Excel Formulas & Functions
    Replies: 0
    Last Post: 04-22-2015, 04:58 PM
  3. determining when multiple values occur at the same time
    By shaun.burke in forum Excel Formulas & Functions
    Replies: 6
    Last Post: 08-06-2014, 07:07 AM
  4. Changing numerical values of cells based on time.
    By matt.wolst in forum Excel General
    Replies: 4
    Last Post: 10-20-2012, 08:14 PM
  5. [SOLVED] Excel 2007 : Determining TRUE or FALSE based on multiple values
    By BarnesB in forum Excel General
    Replies: 5
    Last Post: 05-30-2012, 04:46 PM
  6. Determining project phase based on specified phase time point intervals
    By ElPorko in forum Excel Programming / VBA / Macros
    Replies: 2
    Last Post: 11-05-2008, 09:46 AM
  7. Determining a price based on a range of values
    By Lipper in forum Excel General
    Replies: 3
    Last Post: 08-26-2008, 12:12 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