Click here to Skip to main content
15,031,941 members
Please Sign up or sign in to vote.
0.00/5 (No votes)
There will be one text box where user will enter excel formula.

I want to check that user has entered valid formula or not.

for example,
1. SUM(C2:C11*D2:D11) => Valid

2. C2:C11 SUM D2:D11   => Invalid

1 solution

One quite simple way would be to use Interop and using Evaluate[^] method check what is the return value of the evaluate. If it returns an error, then the formula is invalid.
Amol Lendave 16-Jul-15 3:44am
Thanks for quick response.

Can we do same using OpenOffice or any another option it should be open source.
Actually I'm not using MSOffice
Wendelius 16-Jul-15 3:55am
Unfortunately I don't know OpenOffice well enough. I know they have a SDK so perhaps something similar exists. The main idea is still to simply set the formula and check if error is raised...

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)

CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900