Expected expression error help

C

Chet

Can anyone figure out why this line of code creates the compile error
message "expected expression"? I am trying to put a formula array
into a cell.

Selection.FormulaArray = _
"=SUM(IF('Raw data'!R4C6:R" & MaxRowSource & "C6=RC2,IF('Raw data'!
R4C" & SourceDOWCol & ":R" & MaxRowSource & "C" & SourceDOWCol &
=""x"", _
"IF('Raw data'!R4C17:R" & MaxRowSource & "C17<R3C,IF('Raw data'!
R4C18:R" & MaxRowSource & "C18>R3C,'Raw data'!R4C16:R" & MaxRowSource
& "C16)))))"

Thanks,
Chet
 
P

Per Jessen

Hi

It seems that you have to many quotation signs in the formula string.
This should do it:

Selection.FormulaArray = _
"=SUM(IF('Raw data'!R4C6:R" & MaxRowSource & "C6=RC2,IF('Raw
data'! R4C" _
& SourceDOWCol & ":R" & MaxRowSource & "C" & SourceDOWCol & _
"=""x"", IF('Raw data'!R4C17:R" & MaxRowSource & _
"C17<R3C,IF('Raw data'! R4C18:R" & MaxRowSource & _
"C18>R3C,'Raw data'!R4C16:R" & MaxRowSource & "C16)))))"

Regards,
Per
 
C

Chet

Hi

It seems that you have to many quotation signs in the formula string.
This should do it:

Selection.FormulaArray = _
    "=SUM(IF('Raw data'!R4C6:R" & MaxRowSource & "C6=RC2,IF('Raw
data'! R4C" _
    & SourceDOWCol & ":R" & MaxRowSource & "C" & SourceDOWCol & _
    "=""x"", IF('Raw data'!R4C17:R" & MaxRowSource & _
    "C17<R3C,IF('Raw data'! R4C18:R" & MaxRowSource & _
    "C18>R3C,'Raw data'!R4C16:R" & MaxRowSource & "C16)))))"

Regards,
Per





- Show quoted text -

Thank you.. that worked splendidly! Chet
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top