Formula for obtaining data from a pivot table where there is 1 column with 2 headings

sikhwizard

New Member
Joined
Apr 24, 2014
Messages
8
Hi All,

I have some data (about 45,000 lines) which has 4 columns, DATE, NUMBER 1, NUMBER 2, GRADE,

See example below.

DateNumber 1Number 2Grade
01/01/201402476959972020787653691
01/01/201402476959973020787656173
01/01/201402476959976020787653281
01/01/201401212783637012038759051
02/01/201402476959972020787653693
03/01/2014024769599720207876536911
03/01/201402476959972020787653693
04/01/201402476959972020787653693
05/01/201402476959973020787656172
05/01/201402476959973020787656156
05/01/201402476959972020787653693
06/01/201402476959973020787656175
06/01/201402476959972020787653693
08/01/201402476959973020787656176
11/01/201402476959973020787656175
16/01/201402476959973020787656174
18/01/201402476959973020787656175
18/01/201402476959973020787656156

<COLGROUP><COL style="WIDTH: 56pt; mso-width-source: userset; mso-width-alt: 2742" width=75><COL style="WIDTH: 63pt; mso-width-source: userset; mso-width-alt: 3072" span=2 width=84><COL style="WIDTH: 33pt; mso-width-source: userset; mso-width-alt: 1609" width=44><TBODY>
</TBODY>

I find it easy putting this in a pivot table as the data looks as below, and its easy to relate that where;

Number 1 = 01212783637, then this has a value of 1 where it is associated to Number 2 = 01203875905

Number 1 = 02476959973, then this has a value of 6 where it is associated to Number 2 = 02078765615 & a value of 30 where it is associated to Number 2 = 02078765617
Row LabelsSum of Grade
012127836371
012038759051
0247695997227
0207876536927
0247695997336
020787656156
0207876561730
024769599761
020787653281

<COLGROUP><COL style="WIDTH: 97pt" span=2 width=129><TBODY>
</TBODY>

However, I want to get the data to look like below;
Number 1</SPAN>Number 2</SPAN>Sum of Grade</SPAN>
01212783637</SPAN>01203875905</SPAN>1</SPAN>
02476959972</SPAN>02078765369</SPAN>27</SPAN>
02476959973</SPAN>02078765615</SPAN>6</SPAN>
02476959973</SPAN>02078765617</SPAN>30</SPAN>
02476959976</SPAN>02078765328</SPAN>1</SPAN>

<TBODY>
</TBODY><COLGROUP><COL><COL><COL></COLGROUP>

Am I going about this the wrong way and if I was to continue with the Pivot table, how would i separate the 2 headings in the same column?


Thanks in advance.
 

Excel Facts

Select all contiguous cells
Pressing Ctrl+* (asterisk) will select the "current region" - all contiguous cells in all directions.
Right click the pivot table, click options, go to display tab, check the box 'Classic Pivot Table View".
 
Upvote 0
Thanks thats fantastic guys.

I now have a related question, if there is a Number 1 has 2 or more associated values for Number 2, how can this be displayed for each line?

Where ???? would be 02476959973</SPAN>. I have seen where you can merge the cells, but I want a 1:1 relationship if that makes sense.

Sum of Grade</SPAN>
Number 1</SPAN>Number 2</SPAN>Total</SPAN>
01212783637</SPAN>01203875905</SPAN>1</SPAN>
02476959972</SPAN>02078765369</SPAN>27</SPAN>
02476959973</SPAN>02078765615</SPAN>6</SPAN>
????</SPAN>02078765617</SPAN>30</SPAN>
02476959976</SPAN>02078765328</SPAN>1</SPAN>

<TBODY>
</TBODY><COLGROUP><COL><COL><COL></COLGROUP>
 
Upvote 0
This cannot be done within the PivotTable. You can copy the data from the pivot table into a new range, but then you lose the ability to slice your data...

If you don't mind losing the pivot...

Copy all data, paste special values into a different area of the workbook, select the entire range, use 'go to special' and go to blanks (hot keys: alt, h, fd, s, k, enter), then hit "=" then up-arrow, then hit ctrl+enter.

That might be hard to follow as it reads, but it works.
 
Upvote 0
This cannot be done within the PivotTable. You can copy the data from the pivot table into a new range, but then you lose the ability to slice your data...

If you don't mind losing the pivot...

Copy all data, paste special values into a different area of the workbook, select the entire range, use 'go to special' and go to blanks (hot keys: alt, h, fd, s, k, enter), then hit "=" then up-arrow, then hit ctrl+enter.

That might be hard to follow as it reads, but it works.
This can be done in XL 2007 and later by the following:

1) Select the pivot table
2) Go to the Design menu
3) Click Report Layout >> Show in Tabular Form
4) Click Report Layout >> Repeat All Item Labels

01212783637012038759051
024769599720207876536927
02476959973
020787656156
02476959973
0207876561730
02476959976020787653281

<tbody>
</tbody>

Assuming this is what you are going for.
 
Upvote 0
I thought I used the feature when I was still using 2007, but I stand corrected, I just looked it up. You are correct, 2010+
 
Upvote 0

Forum statistics

Threads
1,214,920
Messages
6,122,272
Members
449,075
Latest member
staticfluids

We've detected that you are using an adblocker.

We have a great community of people providing Excel help here, but the hosting costs are enormous. You can help keep this site running by allowing ads on MrExcel.com.
Allow Ads at MrExcel

Which adblocker are you using?

Disable AdBlock

Follow these easy steps to disable AdBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the icon in the browser’s toolbar.
2)Click on the "Pause on this site" option.
Go back

Disable AdBlock Plus

Follow these easy steps to disable AdBlock Plus

1)Click on the icon in the browser’s toolbar.
2)Click on the toggle to disable it for "mrexcel.com".
Go back

Disable uBlock Origin

Follow these easy steps to disable uBlock Origin

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back

Disable uBlock

Follow these easy steps to disable uBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back
Back
Top