Use cell contents as part of array

CPT JPmorgan

New Member
Joined
May 28, 2008
Messages
19
Not sure why I'm having such a hard time with this, but I'm sure you guys will make it look easy. I have a formula I am using to get the total of multiple items within a pivottable.

=SUM(GETPIVOTDATA("Data",Pivot!$A$3, "Application", "MyApplication", "Category",E40,"Function",{"Item1", "Item2", "Item3"}))

What I need, is to replace the {Item1,Item2...} with a reference to cell F40. F40 will contain the text "Item1", "Item2", "Item3" (I can include the {} in this cell as well, but that hasnt helped me yet either). The reason I need this to be a reference to 1 cell and have all the items listed in this 1 cell, is because we are constantly changing which items are included in this total. (And there are a lot of totals with constantly changing items)

I have tried INDIRECT, TEXT, and everything which way I can think of. I would really appreciate any help with this! Thanks guys!
 

Excel Facts

Get help while writing formula
Click the italics "fx" icon to the left of the formula bar to open the Functions Arguments dialog. Help is displayed for each argument.
I found something that worked from here: http://excel.bigresource.com/Track/excel-yDTYgcHb/

I created a user defined function and it works like a charm. Here is the function:
Option Explicit
Public Function funcARRAY(sCellRef As String) As Variant
Dim vCellSplit As Variant
If sCellRef = "" Then Exit Function
vCellSplit = Split(sCellRef, ", ")
funcARRAY = vCellSplit

End Function


And here is the formula:
=SUM(GETPIVOTDATA("Call Record No.",Pivot!$A$3,"Application",E40,"Category",F40,"Function",funcARRAY(G40)))

(CTRL+SHIFT+ENTER of course)
 
Upvote 0
On a side note... if anyone can think of an easy way to account for a missing item/function, that would be AWESOME! Normally, i use an iferror(getpivotA,0)+iferror(getpivotb,0) So if we havent had any occurences of B when pulling the report, it wont show in the pivottable. When you write out all the getpivotA+B, etc, you can just have it count as a 0 if there is no item in the pivottable. But I really cant do that for what im trying to do now, which is why I went through the mess of creating everything above. Is there an easy way to check EACH item in the array for errors and count a single item as a 0 if it is missing instead of getting a REF error?
 
Upvote 0

Forum statistics

Threads
1,224,591
Messages
6,179,768
Members
452,940
Latest member
rootytrip

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