# Is it possible to analyse a formula that is passed as a variable

Hello,

We have an excel sent by the users that need to be processed that will contain the following data:
Variable Name | Condition 1 | Operator | Condition 2 | True Statement | False Statement
Ex:
MyVariable1 | A | = | B | They are the same | They are not the same
Myvariable2 | A | <> | B | The are different | They are not different
MyVariable3 | 1 | > | 2 | Bigger | Smaller
MyVariable4 | 1 | = | “” | Is Empty | Is not empty

The number of rows is undefined, we need to replace in a document “MyVariable1”, “MyVariable2”, “MyVariable3”… with the true statement or false statement depending if the condition is true or false (based on the 3 columns “Condition 1 / Operator / Condition 2”.

We managed to do that by assigning every element to a variable but it forced us to have a static table. How is it possible to implement it using a unknown numbers of row, unknown operator, and unknown variable name?

Amanda

There is no way to execute a formula stored in a variable.

The only way to achieve your goal would be to split the data on | and use a complicated set of if/then or switch/case logic to process it.

is there only one column in excel with all expression ? if its the case you can use read range activity (workbook) and inside For Each Row in DataTable you can split the value into array of string.

Create Array variable of type String and inside for each, assign the current row to this variable like this:

stringArrayVariable = currentRow(0).ToString.Split("|"c)

stringArrayVariable(0) = value is Variable Name
stringArrayVariable(1) = value is Condition 1
stringArrayVariable(2) = value is Operator
stringArrayVariable(3) = value is Condition 2
stringArrayVariable(4) = value is True Statement
stringArrayVariable(5) = value is They are not the same

Do what you need do, then go to next row