0

All,

I have this data I pulled from a database that I need to readjust. Here it is:

ID | Type     | total
 1    Purchase   12
 1    Return     2
 1    Exchange   5
 3    Purchase   34
 3    Return     4
 3    Exchange   2

The desired result is:

ID | Purchase | Return | Exchange
 1      12         2         5
 3      34         4         2

and so on with a lot more data. Can this be done?

10
  • 1
    And why not a pivot table? Jan 4, 2017 at 14:22
  • Can this be done a pivot table? I tried yesterday and had no luck but if you think so I will mess with it some more.
    – Icebreaker
    Jan 4, 2017 at 14:24
  • Yes it can be done. Put the ID as rows the Type as columns and the total as values. Jan 4, 2017 at 14:26
  • I did that however for the values I get counts. I don't want counts but the actual values to show.
    – Icebreaker
    Jan 4, 2017 at 14:31
  • @Icebreaker Assuming you have only one total value per unique pair of ID and type, you have to use Sum of total for VALUES. See the answer I posted. Jan 4, 2017 at 14:32

1 Answer 1

3

In Excel, format the data like so:

enter image description here

Choose a cell in these data, go to Insert -> PivotTable, insert it where you would like, and use the following settings:

enter image description here

This gives

enter image description here

Under "Design" in the Ribbon (make sure that your PivotTable is selected), go to Grand Totals -> Off for Rows and Columns. This gives

enter image description here

Click the "Exchange" cell and go toward the top of it, right below the "Column Labels" cell - you will see that the arrowhead will change and you can drag the column:

enter image description here

2
  • Ok I see what you are saying. Ok this worked for numbers. Now let me throw a hypothetical at you. What if the totals field wasn't a number. Let's say it represented a series of unique alphanumeric codes (AF458XYZ for example). Can this still be done?
    – Icebreaker
    Jan 4, 2017 at 14:48
  • @Icebreaker This easily? I'd be inclined to say no, but I'd ask that as a separate question. Personally, I would use R rather than Excel for such a case, but that's just me. Jan 4, 2017 at 14:56

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.