如何连接行和Excel中的列显示

时间:2016-05-21 11:34:24

标签: datetime excel-2010 concatenation

Image Link

大家好,

我将列 A 作为日期, B,C,D,E,F 作为时间。我想连接它

J1 = A1 + B1

J2 = A1 + C1

J3 = A1 + D1

J4 = A1 + E1

J5 = A1 + F1

然后

J6 = A2 + B2

J7 = A2 + C2

J8 = A2 + D2

J9 = A2 + E2

J10 = A2 + F2

等等......

1 个答案:

答案 0 :(得分:0)

J1 J5 中输入:

=INDEX(A:A,ROUNDUP(ROW()/5,0))+INDEX(B:B,ROUNDUP(ROW()/5,0))
=INDEX(A:A,ROUNDUP(ROW()/5,0))+INDEX(C:C,ROUNDUP(ROW()/5,0))
=INDEX(A:A,ROUNDUP(ROW()/5,0))+INDEX(D:D,ROUNDUP(ROW()/5,0))
=INDEX(A:A,ROUNDUP(ROW()/5,0))+INDEX(E:E,ROUNDUP(ROW()/5,0))
=INDEX(A:A,ROUNDUP(ROW()/5,0))+INDEX(F:F,ROUNDUP(ROW()/5,0))

然后根据需要将这个公式块复制下来。

<强> 注:

如果数据是文字而非实际日期/时间,请使用&amp; 而不是 +

修改#1:

这个小宏假设第1行是标题行,实际数据从第2行开始:

Sub Jani()
    Dim N As Long, i As Long, j As Long, K As Long

    N = Cells(Rows.Count, "A").End(xlUp).Row
    K = 2
    For i = 2 To N
        For j = 2 To 6
            Cells(K, "J").Value = Cells(i, "A").Value + Cells(i, j).Value
            K = K + 1
        Next j
    Next i
End Sub