In C# can't introduce a formula in Excel
-
I use C# in Visual studio 2022 (in portuguese) and I have a form solution where I open an Excel file and introduce data. In one cell I have to put a formula: "=IF(H5=0;D5;H5)". When I do this I receive an error: System.Runtime.InteropServices.COMException: 'Exceção de HRESULT: 0x800A03EC'. For simple formulae, like "=B4*C4", it works fine. The error is the same wheter the formula is in portruguese or english. Does anyone know what is hapening? Thanks.
-
I use C# in Visual studio 2022 (in portuguese) and I have a form solution where I open an Excel file and introduce data. In one cell I have to put a formula: "=IF(H5=0;D5;H5)". When I do this I receive an error: System.Runtime.InteropServices.COMException: 'Exceção de HRESULT: 0x800A03EC'. For simple formulae, like "=B4*C4", it works fine. The error is the same wheter the formula is in portruguese or english. Does anyone know what is hapening? Thanks.
Googling the error code returns several hits suggesting that switching from .xls to the more recent (and more functional) .xlsx format can fix the problem. As always: An error code may have different underlaying causes. Maybe this doesn't help with yours. Make sure to use the .xlsx format anyway, to be sure that that is not the cause of your problems.
-
I use C# in Visual studio 2022 (in portuguese) and I have a form solution where I open an Excel file and introduce data. In one cell I have to put a formula: "=IF(H5=0;D5;H5)". When I do this I receive an error: System.Runtime.InteropServices.COMException: 'Exceção de HRESULT: 0x800A03EC'. For simple formulae, like "=B4*C4", it works fine. The error is the same wheter the formula is in portruguese or english. Does anyone know what is hapening? Thanks.
You should be using comas; not semi-colons. [IF function](https://support.microsoft.com/en-us/office/if-function-69aed7c9-4e8a-4755-a9bc-aa8bbff73be2)
"Before entering on an understanding, I have meditated for a long time, and have foreseen what might happen. It is not genius which reveals to me suddenly, secretly, what I have to say or to do in a circumstance unexpected by other people; it is reflection, it is meditation." - Napoleon I
-
You should be using comas; not semi-colons. [IF function](https://support.microsoft.com/en-us/office/if-function-69aed7c9-4e8a-4755-a9bc-aa8bbff73be2)
"Before entering on an understanding, I have meditated for a long time, and have foreseen what might happen. It is not genius which reveals to me suddenly, secretly, what I have to say or to do in a circumstance unexpected by other people; it is reflection, it is meditation." - Napoleon I
Gerry. You are right. In my language we use semicolons. When I substituted the semicolons with commas, it worked! Thank you!