Welcome to OGeek Q&A Community for programmer and developer-Open, Learning and Share
Welcome To Ask or Share your Answers For Others

Categories

0 votes
227 views
in Technique[技术] by (71.8m points)

rows - How can I turn part of the Excel data to columns to get a desired output?

For eg - Say I have data in the following format -

Current Format
enter image description here

I would need the data to be formatted in the following format for ease of use -

Required Format
enter image description here

Of course the data contains a lot more records - I'm looking for an easy way to transpose data in this way for large sets of data.

Any help will be appreciated :)

See Question&Answers more detail:os

与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…
Welcome To Ask or Share your Answers For Others

1 Reply

0 votes
by (71.8m points)

What you want to do is called:

Unpivot:

  1. Select the data and on the Insert menu choose Table
  2. On the Data menu click From Table/Range
  3. The query window will open. Choose the columns you need to extract. With your data the columns to highlight are "Type" and "Number of Cases"
  4. On the Tranform menu choose Unpivot Columns
  5. If the data looks right now, close the Query Editor (accepting changes).

Examples here: Unpivot Excel Data

img


与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…
OGeek|极客中国-欢迎来到极客的世界,一个免费开放的程序员编程交流平台!开放,进步,分享!让技术改变生活,让极客改变未来! Welcome to OGeek Q&A Community for programmer and developer-Open, Learning and Share
Click Here to Ask a Question

...