+ Reply to Thread
Results 1 to 9 of 9

formula for combining multiple dates, from columns to rows

  1. #1
    Registered User
    Join Date
    12-29-2012
    Location
    Guatemala
    MS-Off Ver
    Excel 2010
    Posts
    4

    formula for combining multiple dates, from columns to rows

    Hi, I need some help, I have being for this for more than 1 week. I would like to combine different date and hours in different columns and rows, and intercalate them into one column. For Example

    (A)=Date
    1= Time1= 6:30
    2= Time2= 7:30
    3= Time3= 8:30

    (A)1 (A)2 (A)3
    (B)1 (B)2 (B)3
    (C)1 (C)2 (C)3
    (D)1 (D)2 (D)3

    or

    ROW COLUMN A COLUMN B COLUMN C
    1 (11/22/2012) 06:30 (11/22/2012) 07:30 (11/22/2012) 08:30
    2 (11/23/2012) 06:30 (11/23/2012) 07:30 (11/23/2012) 08:30
    3 (11/24/2012) 06:30 (11/24/2012) 07:30 (11/24/2012) 08:30
    4 (11/25/2012) 06:30 (11/25/2012) 07:30 (11/25/2012) 08:30


    the result must be something like this:

    (A)1
    (A)2
    (A)3
    (B)1
    (B)2
    (B)3
    (C)1
    (C)2
    (C)3
    (D)1
    (D)2
    (D)3

    or

    Row Column A
    1 11/22/2012 06:30
    2 11/22/2012 07:30
    3 11/22/2012 08:30
    4 11/23/2012 06:30
    5 11/23/2012 07:30
    6 11/23/2012 08:30
    7 11/24/2012 06:30
    8 11/24/2012 07:30
    9 11/24/2012 08:30
    10 11/25/2012 06:30
    11 11/25/2012 07:30
    12 11/25/2012 08:30

    Thank you for your help.
    Attached Files Attached Files
    Last edited by juliomanco; 12-29-2012 at 01:25 PM.

  2. #2
    Forum Expert
    Join Date
    07-16-2010
    Location
    Northumberland, UK
    MS-Off Ver
    Excel 2007 (home), Excel 2010 (work)
    Posts
    3,054

    Re: formula for combining multiple dates, from columns to rows

    Somewhere else on your sheet put:

    =LARGE($A$1:$D$3,ROW(A1))

    And copy down

  3. #3
    Registered User
    Join Date
    12-29-2012
    Location
    Guatemala
    MS-Off Ver
    Excel 2010
    Posts
    4

    Re: formula for combining multiple dates, from columns to rows

    Hi Andrew-R, thank you for the response. I tried what you said but it did not work. I edited my post so it can be more clear, thank you!

  4. #4
    Forum Expert
    Join Date
    07-16-2010
    Location
    Northumberland, UK
    MS-Off Ver
    Excel 2007 (home), Excel 2010 (work)
    Posts
    3,054

    Re: formula for combining multiple dates, from columns to rows

    I think I'm with you, but it would be much easier if you could post a sample workbook.

  5. #5
    Registered User
    Join Date
    12-29-2012
    Location
    Guatemala
    MS-Off Ver
    Excel 2010
    Posts
    4

    Re: formula for combining multiple dates, from columns to rows

    Hi Andrew-R, thank you for the reply, I jus added the workbook, the day must change automatically when copied down.

  6. #6
    Forum Expert
    Join Date
    07-16-2010
    Location
    Northumberland, UK
    MS-Off Ver
    Excel 2007 (home), Excel 2010 (work)
    Posts
    3,054

    Re: formula for combining multiple dates, from columns to rows

    OK, in cell F2 put the formula:

    =OFFSET($A$2,INT((ROW(A1)-1)/3),MOD(ROW(A1)-1,3))

    And copy down

  7. #7
    Registered User
    Join Date
    12-29-2012
    Location
    Guatemala
    MS-Off Ver
    Excel 2010
    Posts
    4

    Re: formula for combining multiple dates, from columns to rows

    Quote Originally Posted by Andrew-R View Post
    OK, in cell F2 put the formula:

    =OFFSET($A$2,INT((ROW(A1)-1)/3),MOD(ROW(A1)-1,3))

    And copy down
    Thank you! that worked really good! I have another question:

    I already had a similar formula: =OFFSET($C$2,INT((ROW()-1)/2),MOD(ROW()+1,2)) but ii only works for only two columns and the one that you gave me works for three columns but it is hard to understand the formula. Could you explain the formula so i can add "n" number of culumns?

  8. #8
    Forum Expert icestationzbra's Avatar
    Join Date
    01-07-2004
    MS-Off Ver
    2007, 2010
    Posts
    1,421

    Re: formula for combining multiple dates, from columns to rows

    the way your data are laid out, you could simply use:

    Please Login or Register  to view this content.
    this one is very straightforward to adapt in case you have more columns. however, if you had anything but numbers in the range, this would not work.

    a better, flexible method would be:

    Please Login or Register  to view this content.
    if you need to add more columns, just update the highlighted ranges.

    see if that works for you.
    Last edited by icestationzbra; 12-29-2012 at 02:58 PM.
    - i.s.z -
    CSE, aka Array aka { }, formulae are confirmed with CONTROL+SHIFT+ENTER.
    Replace commas ( , ) with semicolons ( ; ) in formulae, if your locale setting demands.
    All good ideas are courtesy resources from this forum as well as others around the web.
    - e.o.m -

  9. #9
    Forum Expert
    Join Date
    07-16-2010
    Location
    Northumberland, UK
    MS-Off Ver
    Excel 2007 (home), Excel 2010 (work)
    Posts
    3,054

    Re: formula for combining multiple dates, from columns to rows

    Quote Originally Posted by juliomanco View Post
    I already had a similar formula: =OFFSET($C$2,INT((ROW()-1)/2),MOD(ROW()+1,2)) but ii only works for only two columns and the one that you gave me works for three columns but it is hard to understand the formula. Could you explain the formula so i can add "n" number of culumns?
    The function OFFSET(<start cell>,<rows>,<columns>) returns the value that is in the cell <rows> down and <columns> across from the starting point, so OFFSET(A1,2,1) returns the value that is in cell B3 (two rows down and one row across from A1)

    The Rows() formula just returns the row that the reference cell is in - we start that at A1 and Excel updates it when we copy the formula down a row to A2, to A3 when the formula is copied down 2 rows and so on. So, basically, it's just a counter for how many copies of the formula we have.

    The OFFSET starts in the top left cell of your data and so we initially want the offset to be zero rows and zero columns, in the next row down we want it to be zero rows and one column, then zero rows and two columns and so on. So it moves across one column for every copy of the formula, looping back round to zero when it exceeds the number of columns of data, and moving down a row.

    So, in the formula, the numbers I've put *'s around tell it how many columns of data there are:

    =OFFSET($A$2,INT((ROW(A1)-1)/*3*),MOD(ROW(A1)-1,*3*))

    As long as A2 is the top-left corner of your data you can set that number to however many columns you have and the formula will work.

+ Reply to Thread

Thread Information

Users Browsing this Thread

There are currently 1 users browsing this thread. (0 members and 1 guests)

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