Data Table to Pivot Table then Update Data from Pivot Table

jbesclapez

Active Member
Joined
Feb 6, 2010
Messages
275
Hello,

I would like to have a Data Table that creates a Pivot Table. Then I want to insert or change data in the pivot table that would "update" the Data Table back. It will be a 2 steps thing.

Here is the Table :

ColAColBColCColD
CH1.4PEQ001R19OK
LOUPEQ001R13ToDo
CH1.4DIARQ001R22OK
CH1.4DIARQ001R31OK
BIDLOCOQ001R21ToDo
BIDLOCOQ001R31bToDo
CH1.4LOCOQ005R03ToDo
GAPOEQ005R01INCOH
CH1.4OEQ005R04INCOH
CH1.4OEQ006R05OK
GAPOEQ006R01OK
BIDPEQ001R19OK
GAPPEQ001R13ToDo
CH1.4PEQ005R04OK
LOUPEQ001R31bToDo

<tbody>
</tbody>


And it creates a table like below (same then a pivot table)
Please note the cell A1. It has to be filtered on that which is the ColB of the table.


PE
Q001R19Q001R13Q001R22Q001R31Q001R21Q001R31bQ005R03Q005R01Q005R04Q006R05Q006R01
CH1.4OKOK
LOUToDoToDo
BIDOK
GAPToDo

<tbody>
</tbody>

I know it is tricky because a Pivot table cannot be done as it does not work with Data. (only count, sum...). The trick I used was to put a unique number in ColD and in the pivot table show the MAX number. Then I did a replace to change the number with actual Name in ColD. However, I have not idea how to go back from Pivot Table to Data Table...

I hope one of you will know how to do that better than me.

Thanks for your time
 

Excel Facts

Move date out one month or year
Use =EDATE(A2,1) for one month later. Use EDATE(A2,12) for one year later.
it isn't totally clear what is wanted

a query table can return the cross-tab table. like you describe, this can be done with a MAX (or other) function as it works on text

so a table such as

TRANSFORM MAX(ColD)
SELECT ColA
FROM YourTable
GROUP BY ColA
PIVOT ColC

And if you want it filtered, add
WHERE ColB = 'PE'
between the FROM and GROUP BY clauses

this could be parameterised and linked to a cell if it suited

I'll have a google for some old examples that are similar (in that they give the cross tab result), and post soon with link/s

PS here was one https://www.mrexcel.com/forum/excel-questions/384664-can-i-return-text-pivot-table.html
 
Last edited:
Upvote 0
Hi there,

Sorry for the late reply Fazza, but i got super busy and then the holidays came by... Now back to work. And I still have the same problem. This time I will try to describe it better with exemples.

NameColorTaste
JohnBlueLike
PeteBlueDislike
MikeBlueLike
FrankBlueDislike
JohnRedLike
PeteRedDislike
JohnYellowLike
PeteYellowDislike
MikeYellowLike
FrankYellowDislike

<tbody>
</tbody>


This should turn into that :

BlueRedYellow
FrankDislikeDislike
JohnLikeLikeLike
MikeLikeLike
PeteDislikeDislikeDislike

<tbody>
</tbody>


The source is always 3 columns.
The source is always in column F1 with a Header.
The Destination Should be in a worksheet called TabSI in cell A1
The source has N rows with no empty field.

In Kutools addin, it is under Range > Transpose Table Dimension > List to cross table.
e0YCFm

Screen_Shot_2017_10_25_at_9_39_39_AM.png



Hope I am clearer now. Please could anyone help on that?


Thanks
 
Last edited:
Upvote 0
got below formula from ExcelIsFun videos

place cursor in cell A1 and paste below data
NameColorTaste
JohnBlueLike
PeteBlueDislike
MikeBlueLike
FrankBlueDislike
JohnRedLike
PeteRedDislike
JohnYellowLike
PeteYellowDislike
MikeYellowLike
FrankYellowDislike

<tbody>
</tbody>

type below formula in cell A14 and drag it down as many cells u wish, to list out unique names
=INDEX($A$2:$A$11,SMALL(IF(FREQUENCY(MATCH($A$2:$A$11,$A$2:$A$11,0),ROW($A$2:$A$11)-ROW($A$2)+1),ROW($A$2:$A$11)-ROW($A$2)+1),ROWS(A$14:A14)))

type below formula in cell B13 and drag it to right as many cells u wish, to list out unique color
=INDEX($B$2:$B$11,SMALL(IF(FREQUENCY(MATCH($B$2:$B$11,$B$2:$B$11,0),ROW($B$2:$B$11)-ROW($B$2)+1),ROW($B$2:$B$11)-ROW($B$2)+1),COLUMNS($B13:B13)))

type below formula in cell B14 and drag it to across the cells, to retrieve the column Taste values
=IFERROR(INDEX($C$2:$C$11,MATCH($A14&B$13,$A$2:$A$11&$B$2:$B$11,0)),"")

NOTE after typing complete formula press CTRL SHIFT ENTER to make array formula

hope it helps you
 
Last edited:
Upvote 0
got below formula from ExcelIsFun videos

place cursor in cell A1 and paste below data
NameColorTaste
JohnBlueLike
PeteBlueDislike
MikeBlueLike
FrankBlueDislike
JohnRedLike
PeteRedDislike
JohnYellowLike
PeteYellowDislike
MikeYellowLike
FrankYellowDislike

<tbody>
</tbody>

type below formula in cell A14 and drag it down as many cells u wish, to list out unique names
=INDEX($A$2:$A$11,SMALL(IF(FREQUENCY(MATCH($A$2:$A$11,$A$2:$A$11,0),ROW($A$2:$A$11)-ROW($A$2)+1),ROW($A$2:$A$11)-ROW($A$2)+1),ROWS(A$14:A14)))

type below formula in cell B13 and drag it to right as many cells u wish, to list out unique color
=INDEX($B$2:$B$11,SMALL(IF(FREQUENCY(MATCH($B$2:$B$11,$B$2:$B$11,0),ROW($B$2:$B$11)-ROW($B$2)+1),ROW($B$2:$B$11)-ROW($B$2)+1),COLUMNS($B13:B13)))

type below formula in cell B14 and drag it to across the cells, to retrieve the column Taste values
=IFERROR(INDEX($C$2:$C$11,MATCH($A14&B$13,$A$2:$A$11&$B$2:$B$11,0)),"")

NOTE after typing complete formula press CTRL SHIFT ENTER to make array formula

hope it helps you

Hi Krrishhkrsna, I just tried that but it does not seem to be working.

BlueBlueBlue
John
John
John
John

<tbody>
</tbody>
 
Last edited:
Upvote 0
create new workbook with .xlsm extension


follow the below link instructions
https://youtu.be/u-wvTDFbvw8



create new sheet and name as Formula
Distinct Count Name SUMPRODUCT(--(ISTEXT(NameRange))/COUNTIF(NameRange,NameRange&""))
Color SUMPRODUCT(--(ISTEXT(ColorRange))/COUNTIF(ColorRange,ColorRange&""))


Name Range OFFSET(Sheet1!$A$2,,,COUNTA(Sheet1!$A:$A)-1)
Color Range OFFSET(Sheet1!$B$2,,,COUNTA(Sheet1!$B:$B)-1)
Tast Range OFFSET(Sheet1!$C$2,,,COUNTA(Sheet1!$C:$C)-1)


uniqueName INDEX(NameRange,SMALL(IF(FREQUENCY(MATCH(NameRange,NameRange,0),ROW(NameRange)-ROW($A$2)+1),ROW(NameRange)-ROW($A$2)+1),ROWS(G$2:G2)))
uniqueColor INDEX(ColorRange,SMALL(IF(FREQUENCY(MATCH(ColorRange,ColorRange,0),ROW(ColorRange)-ROW($B$2)+1),ROW(ColorRange)-ROW($B$2)+1),COLUMNS($H1:H1)))
Tastedata IFERROR(INDEX(TasteRange,MATCH($G2&H$1,NameRange&ColorRange,0)),"")




create new sheet and name as Data
place cursor in range A1 and paste your raw data into that




press Alt F11 to open VBeditor window and paste below code into new module
Option Explicit


Sub PivotheunPivot()


Sheets("Data").Range("E1").FormulaArray = "=" & Sheets("Formula").Range("C1")
Sheets("Data").Range("E2").FormulaArray = "=" & Sheets("Formula").Range("C2")


'UniqueNameList
Sheets("Data").Range("G2").Select
ActiveCell.FormulaArray = "=" & Sheets("Formula").Range("C8")
ActiveCell.Offset(Range("E1") - 1, 0).Select 'E1 holding value of Name Distinct Count
Range(Selection, ActiveCell.End(xlUp)).Select
Selection.FillDown


'UniqueColorList
Sheets("Data").Range("H1").Select
ActiveCell.FormulaArray = "=" & Sheets("Formula").Range("C9")
ActiveCell.Offset(0, Range("E2") - 1).Select 'E2 holding value of Color Distinct Count
Range(Selection, Selection.End(xlToLeft)).Select
Selection.FillRight


'TasteResult
Sheets("Data").Range("H2").Select
ActiveCell.FormulaArray = "=" & Sheets("Formula").Range("C10")
Range(Selection, Selection.Offset(Range("E1") - 1, Range("E2") - 1)).Select
Selection.FillDown
Selection.FillRight


Range("A2").Select


End Sub




if you want to change sheet name Formula and Data, update changed name in VB code accordingly


i think this might helps you. i dont know how to upload excel file here so given lengthy instructions to you along with 6 min youtube video link :D
 
Upvote 0
For info, the solution I posted does what was asked. No formulas & no VBA. Also, it should be quick on large datasets.

TRANSFORM MAX(Taste)
SELECT Name
FROM YourTable
GROUP BY Name
PIVOT Color
 
Upvote 0
hi Fazza,

is below SQL code and where needs to be enter

TRANSFORM MAX(Taste)
SELECT Name
FROM YourTable
GROUP BY Name
PIVOT Color[/QUOTE]
 
Upvote 0

Forum statistics

Threads
1,215,223
Messages
6,123,711
Members
449,118
Latest member
MichealRed

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