How to evaluate dynamic string expression, to formula

matfe

New Member
Joined
Jul 5, 2017
Messages
1
Hi there,

based on a serie of input values in cells in range $E$4:$E$8 and in a serie of auxiliar booleans ($F$4:$F$8)that are funtions of the input cells, i generate a string expression using the following formula:

="SUMPRODUCT("&IF($F$4=TRUE,"(Data!$C$3:$C$20000='Retention Analysis'!$E$4)*","")&IF($F$5=TRUE,"('Retention Analysis'!$E$5=Data!$D$3:$D$20000)*","")&IF($F$6=TRUE,"('Retention Analysis'!$E$6=Data!$G$3:$G$20000)*","")&IF($F$7=TRUE,"('Retention Analysis'!$E$7=Data!$E$3:$E$20000)*","")&IF($F$8=TRUE,"('Retention Analysis'!$E$8=Data!$F$3:$F$20000)*","")&"($D51=Data!$A$3:$A$20000)*(E$50=Data!$B$3:$B$20000)*"&"(Data!$H$3:$H$20000))"

This formula basically builds dinamically the equivalent string expression of the formula i would need to evaluate based on the input values.

The problem is that i'm not finding a way of evaluating this string expression.

I have already tried to use this vba function:

Function Eval(r As Range) As Variant
Eval = Evaluate(r.Value)
End Function

With no success.

And the indirect function doesn't seems to be a good a approach as i need to evaluate the whole expression together and not just ranges.

Anyone none if this would be possible?

Thanks in advance
 

Excel Facts

Save Often
If you start asking yourself if now is a good time to save your Excel workbook, the answer is Yes
Hello,

Have you tried form the Main Menu ... Formulas > Evaluate Formula ?
 
Upvote 0
@matfe ...

1. What is the cell address where you're trying to output the result of this concatenated formula?

2. Is this a one-time occurrence in your sheet? Or is this type of concatenated formula something you'll be trying to use throughout the sheet?

3. If you were to succinctly name this formula of yours, what would you call it? In other words, what is a short, descriptive name for what it does?

4. Which version of Excel are you running?
 
Last edited:
Upvote 0

Forum statistics

Threads
1,224,829
Messages
6,181,224
Members
453,025
Latest member
Hannah_Pham93

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