Search code examples
excelpivotpivot-tablepowerquery

How to get a list of manually modified values of a column from a Pivot Table?


I cannot find an answer to my problem anywhere. Sometimes, by mistake, when I press the spacebar, a value in my pivot table gets replaced with empty. Once I realize this has happened, I can't determine which value was there previously, nor can I find a list of previous values compared to the current manually modified value.

Example ( this is an example table on which I will substitute the Value Tokyo for " ").

Original Table

In the new table Tokyo appears as:

New Table with Tokyo substituted

Even if I press update on the table, the value Tokyo won't come back and will remain blank.

What I'm looking for is somewhere I can find all the values modified and the new values.


Solution

  • If you activate any cell in the pivot table, this macro will reset all pivot items if the city field to their original values:

    Sub ResetFieldItemNames()
        Dim itm As PivotItem
        For Each itm In ActiveCell.PivotTable.PivotFields("city").PivotItems
            If itm.SourceName <> itm.Name Then
                itm.Name = itm.SourceName
            End If
        Next
    End Sub