I have a pivot table with a list of people and some total values for each. I need to go through the list and select only those for which some total values are less than zero in order to do further action.
What’s the best way to do it?
Handle the Pilot OutputRange directly on the sheet? In this case, the formula GETPIVOTDATA is useless.
Going through the entries on the sheet, I would know what to substitute in formula GETPIVOTDATA , but then it wouldn’t be necessary, because the total value would be on the right side of the table row.
What are your thoughts? I’m leaning toward the idea of processing the range on the sheet with a separate procedure. Disadvantages: If the user changes the table view, the procedure will not work. So an additional check of the current table layout is required. This is also inconvenient.
I saw an example:
GETPIVOTDATA from a cell
NOTE: That doesn’t work for me, because between the person’s name and the total value in the data field area, there are some values in the row field area that I have to enter into the formula to fully identify the entry. Otherwise, the formula won’t work because of the ambiguity of the data.
We are talking about fields that it is reasonable to display in the pivot table, but which are related to the person by a one-to-one relationship. But I have to put all these criterion pairs (field-item) into the formula. This adds nothing to the entry identification, but should be entered in the formula. However, the formula GETPIVOTDATA knows nothing about the relationship between fields and does exactly the right thing.
Excel has a corresponding method: Excel PivotTable.GetPivotData
Because of the note above, it would still be inconvenient to use.
UPD. The pivot table interface seems to allow you to build and customize a pivot table, but not to retrieve related data. Or is it possible, using the pilot table API, to retrieve the required record with all related fields?