Entering quote marks in SUMIF function

B

bony_tony

Hi,
I'm trying to enter a variable as the criteria for the sumif function
from my macro. I can't seem to get the criteria in quote marks...

Cells(ActiveSheet.UsedRange.Rows.Count,
Range("Amount").Column).FormulaR1C1 = "=SUMIF(C[-10],"" & i & "",C)"
enters the formula as =SUMIF(B:B," & i & ",L:L), and

Cells(ActiveSheet.UsedRange.Rows.Count,
Range("Amount").Column).FormulaR1C1 = "=SUMIF(C[-10]," & i & ",C)"
enters the formula as SUMIF(B:B,ABC123,L:L).

I need SUMIF(B:B,"ABC123",L:L).

Can someone help please?
I've ran out of logical soultions..

Tony
 
G

Guest

Tony,

try it like this:

Range("Amount").Column).FormulaR1C1 = "=SUMIF(C[-10],""" & i & """,C)"
 
B

bony_tony

Well that was simple
Why 3 " ?
Doesn't seem to make sense to me
Wouldn't the second " in the group of 3 close the string? Why is there
3rd one?

T

Tony,

try it like this:

Range("Amount").Column).FormulaR1C1 = "=SUMIF(C[-10],""" & i & """,C)"

--
Hope that helps.

Vergel Adriano



bony_tony said:
Hi,
I'm trying to enter a variable as the criteria for the sumif function
from my macro. I can't seem to get the criteria in quote marks...
Cells(ActiveSheet.UsedRange.Rows.Count,
Range("Amount").Column).FormulaR1C1 = "=SUMIF(C[-10],"" & i & "",C)"
enters the formula as =SUMIF(B:B," & i & ",L:L), and
Cells(ActiveSheet.UsedRange.Rows.Count,
Range("Amount").Column).FormulaR1C1 = "=SUMIF(C[-10]," & i & ",C)"
enters the formula as SUMIF(B:B,ABC123,L:L).
I need SUMIF(B:B,"ABC123",L:L).
Can someone help please?
I've ran out of logical soultions..
Tony- Hide quoted text -

- Show quoted text -
 

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