Excel Formula - Error 1004 - Bug? Mistake?

  • Thread starter Thread starter Markus Wilthaner
  • Start date Start date
M

Markus Wilthaner

Hello,

I have a worksheet and the following line of code:
Me.Range("G11").Formula = "=SUMIF(A1;1;A3:A6)"

Excel says: 1004 Application error

What am I doing wrong? If I enter the exact same string as a formula,
everything works fine. Help! :)


Markus
 
Either change the semi colons (;) to commas or use FormulaLocal rather than
Formula (assuming your list separator is set to semicolon).

However, I don't thing the formula will produce what you want.

Maybe you want an if statement
=If(A1=1,Sum(A3:A6),0)
 
Tom Ogilvy said:
Either change the semi colons (;) to commas or use FormulaLocal rather than
Formula (assuming your list separator is set to semicolon).

First, thanks for helping me out.
You were right, the semi colons are my list separator. Excel is smart
and replaces commas in the from-code-formulas with the semicolons.

I tried the same script on my Excel 2003 computer and it filled in the
formulas. However, all I get is an "Name" Error. When I edit the cell
(F2) and press enter without changing anything, it works! Odd....

Using "LocalFormula" causes my Excel 2003 to give me that 1004
Application error. :(

What I was trying to accomplish is to count the occurence of a giving
string in a number of cells, using SUMIF(<Range>, <GivenString>).

Thank you,


Markus
 
Using "LocalFormula"

it isn't localformula, it is formulalocal

when you use formulalocal, the formula should be written as you would enter
it in a cell (including non-english works/names if that is how you work in
your spreadsheet).
 
Back
Top