Cube value function

Is there a way to use cubevalue function that will prompt a user to input a value before it runs?

This is my formula:

=SUM(+N(CUBEVALUE("PowerPivot Data","[Measures].[Sum of PO_MTDY1]",Slicer_Dept_and_segment11,Slicer_Month11,Slicer_Period_id2,)))

I would like the user to input the value for Slicer_period_id2

Thanks
KdankwahAsked:
Who is Participating?
I wear a lot of hats...

"The solutions and answers provided on Experts Exchange have been extremely helpful to me over the last few years. I wear a lot of hats - Developer, Database Administrator, Help Desk, etc., so I know a lot of things but not a lot about one thing. Experts Exchange gives me answers from people who do know a lot about one thing, in a easy to use platform." -Todd S.

ProfessorJimJamCommented:
Kdankwah

i believe that you cannot have prompts triggered with built-in functions of Excel.
0
Martin LissOlder than dirtCommented:
I don't know anything about the Cubevalue function, but you can create your own version with VBA. Here's an example where I've created my own version of SUM called xSUM. It sums 3 cells with the 3rd cell being input by the user. A VBA function like this is called a User Defined Function or UDF.  Usage would be =xSUM(A1, B1)

Function xSUM(c1 As Range, c2 As Range) As Long
Dim strResponse As String

strResponse = InputBox("Please enter the the 3rd cell", , "C1")
If strResponse = "" Then
    xSUM = CVErr(xlErrValue)
Else
    xSUM = c1 + c2 + Range(strResponse)
End If
End Function

Open in new window


Just in case you need them, here are instructions on how to install the UDF.

In Excel, Press Alt+F11 to open the Visual Basic Editor (VBE)

Right-click on your workbook name in the "Project-VBAProject" pane (at the top left corner of the editor window). If you don’t see an existing module then select Insert -> Module from the context menu. Otherwise just select the module.

Copy the UDF (you can use the ‘Select All’ button if you like) and paste it into the right-hand pane of the VBA editor ("Module1" window)

Press Alt+F11 again to go back to Excel
0

Experts Exchange Solution brought to you by

Your issues matter to us.

Facing a tech roadblock? Get the help and guidance you need from experienced professionals who care. Ask your question anytime, anywhere, with no hassle.

Start your 7-day free trial
KdankwahAuthor Commented:
Thanks so much
0
Martin LissOlder than dirtCommented:
You're welcome and I'm glad I was able to help.

In my profile you'll find links to some articles I've written that may interest you.
Marty - MVP 2009 to 2015, Experts-Exchange Top Expert Visual Basic Classic 2012 to 2014
1
It's more than this solution.Get answers and train to solve all your tech problems - anytime, anywhere.Try it for free Edge Out The Competitionfor your dream job with proven skills and certifications.Get started today Stand Outas the employee with proven skills.Start learning today for free Move Your Career Forwardwith certification training in the latest technologies.Start your trial today
Spreadsheets

From novice to tech pro — start learning today.

Question has a verified solution.

Are you are experiencing a similar issue? Get a personalized answer when you ask a related question.

Have a better answer? Share it in a comment.