Add Dynamic row number to Excel pivot table

gadesans

New Member
Joined
Aug 7, 2018
Messages
1
Hello experts,
Is it possible to add a Dynamic row label to Excel pivot table?


This is the original data[TABLE="class: grid, width: 500"]
<tbody>[TR]
[TD]REP[/TD]
[TD]PROD[/TD]
[TD]QTY[/TD]
[TD]PRC/UNIT[/TD]
[TD]REV[/TD]
[/TR]
[TR]
[TD]A[/TD]
[TD]NOTEBOOK[/TD]
[TD]5[/TD]
[TD]10[/TD]
[TD]50[/TD]
[/TR]
[TR]
[TD]A[/TD]
[TD]CALCULATOR[/TD]
[TD]4[/TD]
[TD]50[/TD]
[TD]200[/TD]
[/TR]
[TR]
[TD]A[/TD]
[TD]PEN[/TD]
[TD]6[/TD]
[TD]5[/TD]
[TD]30[/TD]
[/TR]
[TR]
[TD]B[/TD]
[TD]NOTEBOOK[/TD]
[TD]7[/TD]
[TD]10[/TD]
[TD]70[/TD]
[/TR]
[TR]
[TD]B[/TD]
[TD]PENCIL[/TD]
[TD]8[/TD]
[TD]2[/TD]
[TD]16[/TD]
[/TR]
[TR]
[TD]C[/TD]
[TD]NOTEBOOK[/TD]
[TD]2[/TD]
[TD]10[/TD]
[TD]20[/TD]
[/TR]
[TR]
[TD]C[/TD]
[TD]PENCIL[/TD]
[TD]3[/TD]
[TD]2[/TD]
[TD]6[/TD]
[/TR]
[TR]
[TD]C[/TD]
[TD]CALCULATOR[/TD]
[TD]5[/TD]
[TD]50[/TD]
[TD]250[/TD]
[/TR]
[TR]
[TD]C[/TD]
[TD]PEN[/TD]
[TD]13[/TD]
[TD]5[/TD]
[TD]65[/TD]
[/TR]
</tbody>[/TABLE]

Standard Pivot table will give formatting like this:
[TABLE="width: 500"]
<tbody>[TR]
[TD]Sum of Total Rev[/TD]
[TD][/TD]
[TD][/TD]
[/TR]
[TR]
[TD]Rep[/TD]
[TD]Product[/TD]
[TD]Total[/TD]
[/TR]
[TR]
[TD]A[/TD]
[TD]Calculator[/TD]
[TD]200[/TD]
[/TR]
[TR]
[TD][/TD]
[TD]Notebook[/TD]
[TD]50[/TD]
[/TR]
[TR]
[TD][/TD]
[TD]Pen[/TD]
[TD]30[/TD]
[/TR]
[TR]
[TD]B[/TD]
[TD]Notebook[/TD]
[TD]70[/TD]
[/TR]
[TR]
[TD][/TD]
[TD]Pencil[/TD]
[TD]16[/TD]
[/TR]
[TR]
[TD]C[/TD]
[TD]Calculator[/TD]
[TD]250[/TD]
[/TR]
[TR]
[TD][/TD]
[TD]Notebook[/TD]
[TD]20[/TD]
[/TR]
[TR]
[TD][/TD]
[TD]Pen[/TD]
[TD]65[/TD]
[/TR]
[TR]
[TD][/TD]
[TD]Pencil[/TD]
[TD]6[/TD]
[/TR]
[TR]
[TD]Grand Total[/TD]
[TD][/TD]
[TD]707[/TD]
[/TR]
</tbody>[/TABLE]

I would like to get a column inserted for Row Number
[TABLE="class: grid, width: 500"]
<tbody>[TR]
[TD]Rep[/TD]
[TD]Row Num[/TD]
[TD]Product[/TD]
[TD]Total[/TD]
[/TR]
[TR]
[TD]A[/TD]
[TD]1[/TD]
[TD]Calculator[/TD]
[TD]200[/TD]
[/TR]
[TR]
[TD][/TD]
[TD]2[/TD]
[TD]Notebook[/TD]
[TD]50[/TD]
[/TR]
[TR]
[TD][/TD]
[TD]3[/TD]
[TD]Pen[/TD]
[TD]30[/TD]
[/TR]
[TR]
[TD]B[/TD]
[TD]4[/TD]
[TD]Notebook[/TD]
[TD]70[/TD]
[/TR]
[TR]
[TD][/TD]
[TD]5[/TD]
[TD]Pencil[/TD]
[TD]16[/TD]
[/TR]
[TR]
[TD]C[/TD]
[TD]6[/TD]
[TD]Calculator[/TD]
[TD]250[/TD]
[/TR]
[TR]
[TD][/TD]
[TD]7[/TD]
[TD]Notebook[/TD]
[TD]20[/TD]
[/TR]
[TR]
[TD][/TD]
[TD]8[/TD]
[TD]Pen[/TD]
[TD]65[/TD]
[/TR]
[TR]
[TD][/TD]
[TD]9[/TD]
[TD]Pencil[/TD]
[TD]6[/TD]
[/TR]
</tbody>[/TABLE]

And, I would like the Row number to be dynamic i.e. if data for A is not displayed, the numbers should increasing serially from 1, 2, 3
 

Excel Facts

Pivot Table Drill Down
Double-click any number in a pivot table to create a new report showing all detail rows that make up that number
imho with standard pivot table it is not possible but you can add column (here: Index) to the source table
Book1
BCDEFG
3IndexREPPRODQTYPRC/UNITREV
41ANOTEBOOK51050
52ACALCULATOR450200
63APEN6530
74BNOTEBOOK71070
85BPENCIL8216
96CNOTEBOOK21020
107CPENCIL326
118CCALCULATOR550250
129CPEN13565
Sheet1
Cell Formulas
RangeFormula
B4:B12B4=ROW(A1)

and use this column in your pivot table
ptindex.png

but it will not be updated automatically if you change/filter your pivot table
 
Last edited:
Upvote 0

Forum statistics

Threads
1,224,827
Messages
6,181,194
Members
453,021
Latest member
pingpong7117

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