Alberto Bustos


I am working with VBA for Excel. I am trying to write this formula in a particular cell:

=SUMIF($C$7EmbarrassedC$296,"=SUBTOTAL",D7Big Smile296)

So, I do this: (j is a variable)

.Offset(j, 3).Formula = "=SUMIF($C$7EmbarrassedC$" & (j + 4) & ", "=SUBTOTAL", D7Big Smile" & (j + 4) & ")"

but it turns red because of the "s around SUBTOTAL.

So, I try this

.Offset(j, 3).Formula = "=SUMIF($C$7EmbarrassedC$" & (j + 4) & ", =SUBTOTAL, D7Big Smile" & (j + 4) & ")"
and this

.Offset(j, 3).Formula = "=SUMIF($C$7EmbarrassedC$" & (j + 4) & ", ' '=SUBTOTAL' ', D7Big Smile" & (j + 4) & ")"

none of them work.

What can I do to get around this problem Thanks, Alberto




Re: Need help concatenating with the " character

Andy Pope


Hi,

You need to double up on the quotes that you want included in the outputed formula.

= "=SUMIF($C$7: C$296,""=SUBTOTAL"",D7: D296)"



I added a couple of spaces to stop the emoticons appearing






Re: Need help concatenating with the " character

Alberto Bustos

Hi Andy,

Thanks a lot! I have finished a long report with this last step.

Alberto