Skip to content
  • Categories
  • Recent
  • Tags
  • Popular
  • World
  • Users
  • Groups
Skins
  • Light
  • Cerulean
  • Cosmo
  • Flatly
  • Journal
  • Litera
  • Lumen
  • Lux
  • Materia
  • Minty
  • Morph
  • Pulse
  • Sandstone
  • Simplex
  • Sketchy
  • Spacelab
  • United
  • Yeti
  • Zephyr
  • Dark
  • Cyborg
  • Darkly
  • Quartz
  • Slate
  • Solar
  • Superhero
  • Vapor

  • Default (No Skin)
  • No Skin
Collapse
Code Project
  1. Home
  2. General Programming
  3. C#
  4. In C# can't introduce a formula in Excel

In C# can't introduce a formula in Excel

Scheduled Pinned Locked Moved C#
csharpquestionvisual-studiohelp
4 Posts 3 Posters 0 Views 1 Watching
  • Oldest to Newest
  • Newest to Oldest
  • Most Votes
Reply
  • Reply as topic
Log in to reply
This topic has been deleted. Only users with topic management privileges can see it.
  • I Offline
    I Offline
    Ismael_1999
    wrote on last edited by
    #1

    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.

    T L 2 Replies Last reply
    0
    • I Ismael_1999

      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.

      T Offline
      T Offline
      trønderen
      wrote on last edited by
      #2

      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.

      1 Reply Last reply
      0
      • I Ismael_1999

        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.

        L Offline
        L Offline
        Lost User
        wrote on last edited by
        #3

        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

        I 1 Reply Last reply
        0
        • L Lost User

          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

          I Offline
          I Offline
          Ismael_1999
          wrote on last edited by
          #4

          Gerry. You are right. In my language we use semicolons. When I substituted the semicolons with commas, it worked! Thank you!

          1 Reply Last reply
          0
          Reply
          • Reply as topic
          Log in to reply
          • Oldest to Newest
          • Newest to Oldest
          • Most Votes


          • Login

          • Don't have an account? Register

          • Login or register to search.
          • First post
            Last post
          0
          • Categories
          • Recent
          • Tags
          • Popular
          • World
          • Users
          • Groups