+ Reply to Thread
Results 1 to 5 of 5

Compare day and time cell with date cell

Hybrid View

stavros21 Compare day and time cell... 01-27-2015, 04:11 PM
Pete_UK Re: Compare day and time cell... 01-27-2015, 04:16 PM
stavros21 Re: Compare day and time cell... 01-27-2015, 04:30 PM
Pete_UK Re: Compare day and time cell... 01-27-2015, 05:10 PM
stavros21 Re: Compare day and time cell... 01-31-2015, 01:34 PM
  1. #1
    Registered User
    Join Date
    12-17-2014
    Location
    Limassol, Cyprus
    MS-Off Ver
    Ms office 2013
    Posts
    22

    Compare day and time cell with date cell

    [LEFT]Hello,

    I have one column with date and time (A2 cell: 2015.01.21 03:19:23) and i want to to a formula if A2 date is later than 2015.01.20 then "buy",if before "sell", if the same date "no". How can i do that when on one cell i have only date and on the other i have day and time?

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

    Re: Compare day and time cell with date cell

    I'm not sure if that is a proper date/time in A2, as a full-stop is not a usual delimiter for a date. Please attach a sample workbook so it can be checked.

    Hope this helps.

    Pete

  3. #3
    Registered User
    Join Date
    12-17-2014
    Location
    Limassol, Cyprus
    MS-Off Ver
    Ms office 2013
    Posts
    22

    Re: Compare day and time cell with date cell

    Please find attached an example. I want to test open date is the same later or before with the one on k2. The same with the Close date

    Thanks
    Attached Files Attached Files

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

    Re: Compare day and time cell with date cell

    You can use this to test for the open date (column B):

    =IF($K$1=LEFT(B2,FIND(" ",B2)-1),"no",IF(--SUBSTITUTE($K$1,".","/")<--SUBSTITUTE(LEFT(B2,FIND(" ",B2)-1),".","/"),"buy","sell"))

    To test for the close date (column E) change the B2 references to E2, then copy both formulae down.

    Hope this helps.

    Pete

  5. #5
    Registered User
    Join Date
    12-17-2014
    Location
    Limassol, Cyprus
    MS-Off Ver
    Ms office 2013
    Posts
    22

    Re: Compare day and time cell with date cell

    Thanks a lot guys

+ 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. Creating a VBA Code for if cell value ='s and Last Time Cell Update Time Date Stamp
    By Sixto2014 in forum Excel Programming / VBA / Macros
    Replies: 9
    Last Post: 02-14-2014, 08:31 PM
  2. compare time values - current time with time in cell range?
    By wyattea in forum Excel Programming / VBA / Macros
    Replies: 3
    Last Post: 09-13-2013, 11:28 PM
  3. Replies: 4
    Last Post: 08-21-2013, 12:41 PM
  4. macro to compare time between two cells if time matches output in third cell
    By kshitij_dch in forum Excel Programming / VBA / Macros
    Replies: 2
    Last Post: 03-31-2012, 07:09 AM
  5. i need a macro code to compare time in two cells cell A and cell b
    By kshitij_dch in forum Excel Programming / VBA / Macros
    Replies: 6
    Last Post: 03-31-2012, 06:52 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