简体   繁体   中英

SUMIF Excel Formula c# Exception Unhandled

I'm trying to use the SUMIF formula in Excel using C#. I'm using the following code:

   oRng = (bSheet.Cells[row, 2] as Excel.Range);
   oRng.Formula = "=SUMIF(Sheet1!A:A;A1;Sheet1!B:B)";

This returns "Exception Unhandled" error. In this case, I tried use another formula as simple SUM(Sheet1!A1:A3) and it worked perfectly.

Thanks a lot!

Try =SUMIF(Sheet1!A:A,A1,Sheet1!B:B) . The argument delimiter should be a comma, not a semicolon.

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM