+ Reply to Thread
Results 1 to 13 of 13

Problem with Index(date+time)

  1. #1
    Forum Contributor
    Join Date
    09-22-2012
    Location
    Malaysia
    MS-Off Ver
    Excel 2010
    Posts
    184

    Problem with Index(date+time)

    Hi,

    =Index(date,F1)+index(time,F1)
    didn't produce same result as Index(date) and Index(time) done separately.

    Tried below and get the date right but the time wrong.
    1)
    =text(index(date,F1),"m/d/yy")+text(index(time,F1),"h:mm")
    2) Set in cell format, m/d/yy h:mm

    date = A1:A10 (In m/d/yy)
    time = B1:B10 (In h:mm)

    How to combine both date and time with index?

  2. #2
    Forum Expert
    Join Date
    05-05-2015
    Location
    UK
    MS-Off Ver
    Microsoft Excel for Microsoft 365 MSO (Version 2402 Build 16.0.17328.20068) 64-bit
    Posts
    30,970

    Re: Problem with Index(date+time)

    Can you post a small file showing expected results.

  3. #3
    Forum Contributor
    Join Date
    09-22-2012
    Location
    Malaysia
    MS-Off Ver
    Excel 2010
    Posts
    184

    Re: Problem with Index(date+time)

    Please have a look. Cheers.
    Attached Files Attached Files

  4. #4
    Forum Guru
    Join Date
    08-05-2004
    Location
    NJ
    MS-Off Ver
    365
    Posts
    13,582

    Re: Problem with Index(date+time)

    I used the two formulas in Column G and H and they give the same results. See attached.

    In G4
    =IF(F4="","",INDEX($A$4:$A$103+$B$4:$B$103,F4))

    In H4
    =INDEX($A$4:$A$103,F4)+INDEX($B$4:$B$103, F4)
    Attached Files Attached Files
    ChemistB
    My 2?

    substitute commas with semi-colons if your region settings requires
    Don't forget to mark threads as "Solved" (Edit First post>Advanced>Change Prefix)
    If I helped, Don't forget to add to my reputation (click on the little star at bottom of this post)

    Forum Rules: How to use code tags, mark a thread solved, and keep yourself out of trouble

  5. #5
    Forum Expert
    Join Date
    05-05-2015
    Location
    UK
    MS-Off Ver
    Microsoft Excel for Microsoft 365 MSO (Version 2402 Build 16.0.17328.20068) 64-bit
    Posts
    30,970

    Re: Problem with Index(date+time)

    I experienced the same problem as David but applying "Chemistb" formulae it worked!

  6. #6
    Forum Guru
    Join Date
    08-05-2004
    Location
    NJ
    MS-Off Ver
    365
    Posts
    13,582

    Re: Problem with Index(date+time)

    I also got the correct answer when, in I4, I used this

    =TEXT(INDEX($A$4:$A$103,F4),"m/d/yy")+TEXT(INDEX($B$4:$B$103,F4),"h:mm")

    If you upload a sheet showing an incorrect result, I can tell you why.

  7. #7
    Forum Expert
    Join Date
    05-05-2015
    Location
    UK
    MS-Off Ver
    Microsoft Excel for Microsoft 365 MSO (Version 2402 Build 16.0.17328.20068) 64-bit
    Posts
    30,970

    Re: Problem with Index(date+time)

    The original file supplied by David produces the wrong result (or may be won't with your "magic"!)

  8. #8
    Forum Guru
    Join Date
    08-05-2004
    Location
    NJ
    MS-Off Ver
    365
    Posts
    13,582

    Re: Problem with Index(date+time)

    Nope, all looks good to me. ::::::Scratching head:::::::::::::

    Did you pay extra for the "bug free" version of Excel?

  9. #9
    Forum Contributor
    Join Date
    09-22-2012
    Location
    Malaysia
    MS-Off Ver
    Excel 2010
    Posts
    184

    Re: Problem with Index(date+time)

    Even my original file shows all is good when I opened again. My working sheet still showing the wrong result. In my working sheet, I use the named range. Tested it in the sample file, it show the correct result. Kind of strange, it is?

  10. #10
    Forum Contributor
    Join Date
    09-22-2012
    Location
    Malaysia
    MS-Off Ver
    Excel 2010
    Posts
    184

    Re: Problem with Index(date+time)

    Chemist,

    Have a look at this.
    Attached Files Attached Files

  11. #11
    Forum Guru
    Join Date
    08-05-2004
    Location
    NJ
    MS-Off Ver
    365
    Posts
    13,582

    Re: Problem with Index(date+time)

    Starting with row 11225, the dates include a time. Even though it's formatted as a date, the time still exists so when you add it to the time in Col B, it gives an incorrect answer. That's what's throwing everything off. I checked Column B and the reverse is not true, all the times are time only.

    To fix this in your formulas
    =INT(Date)+time

  12. #12
    Forum Contributor
    Join Date
    09-22-2012
    Location
    Malaysia
    MS-Off Ver
    Excel 2010
    Posts
    184

    Re: Problem with Index(date+time)

    Now the data is good. Before this, I tried to use the date+time in a chart but the chart went haywire. Tried again this day. The chart reads all the time as 0:00.

  13. #13
    Forum Guru
    Join Date
    08-05-2004
    Location
    NJ
    MS-Off Ver
    365
    Posts
    13,582

    Re: Problem with Index(date+time)

    Are we talking about the time attached to the date in Column A or the separate times in Column B? If it's B, are they actually reading as 0:00 or are they just summihng as 0?

+ 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. locate cell using match index (date & time)
    By rakesh.a.r in forum Excel General
    Replies: 3
    Last Post: 07-03-2012, 01:09 PM
  2. Date Time Problem - stop updating that each time the document is opened
    By Dreammy in forum Excel Formulas & Functions
    Replies: 4
    Last Post: 12-28-2007, 03:31 PM
  3. Date time problem
    By FSt1 in forum Excel General
    Replies: 1
    Last Post: 09-26-2005, 11:05 AM
  4. [SOLVED] Ugh..another time and date problem...HELP
    By Bernie Deitrick in forum Excel Formulas & Functions
    Replies: 6
    Last Post: 09-06-2005, 11:05 AM
  5. Ugh..another time and date problem...HELP
    By Bernie Deitrick in forum Excel Formulas & Functions
    Replies: 6
    Last Post: 09-06-2005, 07:05 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