Forum Discussion

Gerard_Jimenez's avatar
Gerard_Jimenez
Copper Contributor
Mar 30, 2021
Solved

Calculate text formula

Hi all, have been looking all the options for this scenario but haven't found any solution, or at least I have not been able to understand them.

 

I have a formula set that I wish to calculate, where x should be replaced by a value, let's say 10, and calculated as per this example:

 

FormulaResult
11
22
x10
x+212
2x+121
3x+535
10x+20120

 

Any help would be greatly appreciated.

  • Gerard_Jimenez Then you'd need som VBA coding. A small user defined function that I called TxtForm. It takes a text string that looks like a formula and "translates" it into a real formula. See attached.

    I left the helper columns in there so that you can see how the text string in column E is constructed.

     

     

     

5 Replies

    • Gerard_Jimenez's avatar
      Gerard_Jimenez
      Copper Contributor

      Riny_van_Eekelen 

       

      Hi, thanks for your prompt solution, but that wouldn't help as it is more of a manual formula.

       

      To further elaborate, I have 1,750 lines, so typing a formula for each line is not a practical solution, on the other hand, if some formulas change, the result should be recalculated accordingly.

       

      I need something more like:

       

      =(value_before_X)*("convert_x_to_value",10,)+(number)

       

      If no value before X, assume 1, if no X at all, use only number after +.

      • Riny_van_Eekelen's avatar
        Riny_van_Eekelen
        Platinum Contributor

        Gerard_Jimenez Then you'd need som VBA coding. A small user defined function that I called TxtForm. It takes a text string that looks like a formula and "translates" it into a real formula. See attached.

        I left the helper columns in there so that you can see how the text string in column E is constructed.

         

         

         

Resources