ExcelBanter

ExcelBanter (https://www.excelbanter.com/)
-   Excel Programming (https://www.excelbanter.com/excel-programming/)
-   -   Entering quote marks in SUMIF function (https://www.excelbanter.com/excel-programming/388713-entering-quote-marks-sumif-function.html)

bony_tony

Entering quote marks in SUMIF function
 
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


Vergel Adriano

Entering quote marks in SUMIF function
 
Tony,

try it like this:

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


--
Hope that helps.

Vergel Adriano


"bony_tony" wrote:

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



bony_tony

Entering quote marks in SUMIF function
 
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

On May 4, 11:19 am, Vergel Adriano
wrote:
Tony,

try it like this:

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

--
Hope that helps.

Vergel Adriano



"bony_tony" wrote:
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 -





All times are GMT +1. The time now is 01:19 AM.

Powered by vBulletin® Copyright ©2000 - 2025, Jelsoft Enterprises Ltd.
ExcelBanter.com