Excel convert columns to new rows

后端 未结 3 571
渐次进展
渐次进展 2020-12-22 14:49

I have a table that looks like this:

  |   A   |     B      |     C      |     D      |
  +-------+------------+------------+------------+
1 | Name  | Langua         


        
3条回答
  •  挽巷
    挽巷 (楼主)
    2020-12-22 15:37

    The following formula should work. The data in sheet2 would always reflect the data on sheet1 so you wouldn't have to re-run a macro to create a new list.

    That being said, using a macro to generate it is probably a better choice as it would allow more flexability should you need to add a 4th language or something at a later date.

    In Sheet2!A2

    =INDIRECT("Sheet1!A"&ABS(INT((ROW()+1)/3))+1)

    In Sheet2!B2

    =INDIRECT("Sheet1!"&IF(ABS(INT((ROW()+1)/3)-(ROW()+1)/3)=0,"B",IF(ABS(INT((ROW()+1)/3)-(ROW()+1)/3)=(1/3),"C","D"))&ABS(INT((ROW()+1)/3))+1)

    Add the column titles in A1 and B1 then autofill the formula down the sheet.

提交回复
热议问题