将一张纸上的3列数据转换为单行

时间:2016-01-01 23:28:46

标签: excel

我在SHEET 1的3列中有100个联系人,

  

A1 =第一个名字,
  B1 =最后一个名字和
  C1 = Ph号

我希望能够在另一个工作表(SHEET 2)上拖出一行来引用这三列,并且每隔三列删除一行。

'SHEET2'!A1 = 'SHEET1'!A1
'SHEET2'!B1 = 'SHEET1'!B1
'SHEET2'!C1 = 'SHEET1'!C1
'SHEET2'!D1 = 'SHEET1'!A2
'SHEET2'!E1 = 'SHEET1'!B2
'SHEET2'!F1 = 'SHEET1'!C2
'SHEET2'!G1 = 'SHEET1'!A3
'SHEET2'!H1 = 'SHEET1'!B3
'SHEET2'!I1 = 'SHEET1'!C3

有什么想法吗?

1 个答案:

答案 0 :(得分:0)

将此公式放在Sheet2!A1中并拖动

=INDEX(Sheet1!$A:$C,INT((COLUMN()-1)/3)+1,MOD(COLUMN()-1,3)+1)

或作为UDF

Function TransposeBy3(Src As Range) As Variant
    Dim rw As Long, cl As Long
    rw = (Application.ThisCell.Column - 1) \ 3 + 1
    cl = (Application.ThisCell.Column - 1) Mod 3 + 1
    TransposeBy3 = Src.Cells(rw, cl).Value
End Function

将论坛=TransposeBy3(Sheet1!$A:$C)置于Sheet2!A1并拖过