Universal name

theta

Well-known Member
Joined
Jun 9, 2009
Messages
960
Hi all...I have produced a VBA script that pivots XML data

On some occasions there will be an additional pivotfield represented in the pivot as "Sum of NetCCY". All files contain the basic field "Sum of NetEUR"

I would like it so that if "NetCCY" exists, the GETPIVOTDATA formula use this as the criteria, if not then NetEUR is used

I thought I would create a variable (e.g. nNAME) in VBA so that if NetCCY exists, this is the value - else it is NetEUR

PMNCodeSDR.Cells(r, 5).FormulaR1C1 = "=GETPIVOTDATA(""" nNAME """,HPMN!R1C1,""HPMN"",RC1)"

Thoughts?
 
Last edited:

Excel Facts

Formula for Yesterday
Name Manager, New Name. Yesterday =TODAY()-1. OK. Then, use =YESTERDAY in any cell. Tomorrow could be =TODAY()+1.
Update. I have used the following code to determine the nPIVOT value

Code:
CreateXMLPivots

If oPT.PivotFields("TotalNetChargeSDR") <> 0 Then
        nPIVOT = "TotalNetChargeSDR"
    Else
        nPIVOT = "TotalNetCharge"
    End If

This is all within a Private Function (that creates the pivot), I need the whole project to have access to the value of this variable?


Code:
Public Sub

    ' Create Pivots & copy data --------------------------------------------------------
    If CreateXMLpivots(owb, oWS) Then
       'Copy filtered data if HPMN pivot successfully created
       Call CopyFilteredData(owb, oWS)
    End If

So that I can use GETPIVOTDATA with nPIVOT
 
Last edited:
Upvote 0

Forum statistics

Threads
1,224,613
Messages
6,179,903
Members
452,948
Latest member
Dupuhini

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