+ Reply to Thread
Results 1 to 5 of 5

Can't concatenate time and date cells

  1. #1
    Registered User
    Join Date
    10-07-2014
    Location
    sheffield
    MS-Off Ver
    MS office profession plus 2013
    Posts
    1

    Can't concatenate time and date cells

    So i'm trying to create a column, time, which will include two existing columns , time and date.

    I'm trying to plot a graph of time against some variable y, the date for the time i have is split in to two columns, i have tried to concaternate them into one using =TEXT(A2,"m/dd/yy ")&TEXT(B2,"hh:mm:ss") but alas when i plot my graph it doesn't treat each cell in 'time' as an ascending value or even a value for that matter.

    I trialed it out using this as a data set :

    1 03/06/14 16:00:00
    2 03/06/14 17:00:00
    3 03/06/14 18:00:00
    4 03/06/14 19:00:00
    5 03/06/14 20:00:00
    6 03/06/14 21:00:00
    7 03/06/14 22:00:00
    8 03/06/14 23:00:00
    9 04/06/14 00:00:00
    10 04/06/14 01:00:00

    But to no vail it does not produce a linear plot as expected, can someone help me with this problem ?

    Thanks you in advance

  2. #2
    Forum Guru
    Join Date
    03-02-2006
    Location
    Los Angeles, Ca
    MS-Off Ver
    WinXP/MSO2007;Win10/MSO2016
    Posts
    12,624

    Re: Can't concatenate time and date cells

    In the cells holding the concatenation formula, try: =A2 + B2 instead.
    Ben Van Johnson

  3. #3
    Forum Expert daffodil11's Avatar
    Join Date
    07-11-2013
    Location
    Phoenixville, PA
    MS-Off Ver
    MS Office 2016
    Posts
    4,465

    Re: Can't concatenate time and date cells

    That's because the output of the TEXT function is in fact, text. You need them to be exposed to an operation to become values again.

    You can multiply the expression times one to have it evaluated as a value again.

    =(TEXT(A2,"m/dd/yy ")&TEXT(B2,"hh:mm:ss"))*1

    Then, format the cell as date/time etc
    Make Mom proud: Add to my reputation if I helped out!

    Make the Moderators happy: Mark the Thread as Solved if your question was answered!

  4. #4
    Forum Expert newdoverman's Avatar
    Join Date
    02-07-2013
    Location
    Port Dover, Ontario, Canada
    MS-Off Ver
    2010
    Posts
    10,330

    Re: Can't concatenate time and date cells

    If you are not sure what you are dealing with, select the dates and times and click on the Home tab, Number Group, then select GENERAL.

    If all the dates turn into 5 digit values and the times into decimal values they are real Excel dates and times. If that is the case, click undo and you can simply add the cells together as suggested by protonLeah without further processing other than possibly formatting as date and time.

    Otherwise the dates and times are text and have to be converted to real dates and times and the formula by daffodil11 will work for you.

    If neither one works please upload a workbook with your problem data.
    <---------If you like someone's answer, click the star to the left of one of their posts to give them a reputation point for that answer.
    Ron W

  5. #5
    Administrator FDibbins's Avatar
    Join Date
    12-29-2011
    Location
    Duncansville, PA USA
    MS-Off Ver
    Excel 7/10/13/16/365 (PC ver 2310)
    Posts
    52,946

    Re: Can't concatenate time and date cells

    Hi, welcome to the forum

    What you need to understand about dates and times in excel is...

    a date is just a number representing the number of days passed since 1/1/900...and then formated in a way that we recognise as a date

    Time is actually a decimal part of 1 (day), so 06:00 AM is 0.25, 12 noon is 0.5 and 18:00 (or 6 PM) is 0.75
    1. Use code tags for VBA. [code] Your Code [/code] (or use the # button)
    2. If your question is resolved, mark it SOLVED using the thread tools
    3. Click on the star if you think someone helped you

    Regards
    Ford

+ 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. concatenate date and time
    By jej in forum Excel Formulas & Functions
    Replies: 2
    Last Post: 10-06-2014, 09:09 AM
  2. Concatenate Date+Time+Am or PM then sum hours
    By bjsmithinc in forum Excel Formulas & Functions
    Replies: 7
    Last Post: 06-16-2013, 09:17 PM
  3. concatenate a field with date and time
    By Foxcan in forum Excel Formulas & Functions
    Replies: 4
    Last Post: 06-05-2009, 03:30 PM
  4. Concatenate Date and Time
    By Jim15 in forum Excel Programming / VBA / Macros
    Replies: 2
    Last Post: 05-12-2008, 10:14 AM
  5. Date and Time Concatenate Help
    By Mr Gow in forum Excel General
    Replies: 3
    Last Post: 01-22-2007, 10:44 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