I have Excel file that contains values includeing inequality signs as shown in the image below, and I would like to be able to use these inequality signs to judge if statements.
Originally, I was going to use a switch or if activity, but my boss said, “Can’t you just use it directly?” So I’m currently looking for a way to use this String inequality sign directly in formulas.
You can use directly less takhan or greater than in if condition. Since the values will come string we have to convert to integer before checking condition. Refer below post for reference.
There are some ways to achieve it. One of them is to use DataTable.Compute method as the following. However, it’s not very good for maintainability, I think.
My suggestion:
Go with your gut and ignore the boss
What you want is to typeCast a string into an operator. And since an operator technically isn’t a datatype it is pretty hard to do. You end up in writing either more code, or more complex code then your initial thought of defining a switch and a few if/then’s. (Think of maintainability). There is a limited number op logical operators so it shouldn’t be too hard.
Unless of course your boss knows the short sollution to this