ExcelBanter

ExcelBanter (https://www.excelbanter.com/)
-   Excel Programming (https://www.excelbanter.com/excel-programming/)
-   -   Sumproduct with A1 notation instead of R1C1 (https://www.excelbanter.com/excel-programming/416936-sumproduct-a1-notation-instead-r1c1.html)

sgltaylor

Sumproduct with A1 notation instead of R1C1
 
Hi,

I would appreciate some help with the following. I am trying to enter
a sumproduct formula in VBA but using A1 notation instead of R1C1.
Could you someone provide me with an example.

Thanks

Per Jessen

Sumproduct with A1 notation instead of R1C1
 
Hi

Look at this:

TargetRange = "A1:A6"
MyCondition = "Per"
Range("C2").Formula = "=sumproduct(--(" & TargetRange & "=""" _
& MyCondition & """),B1:B6)"


Regards,
Per

"sgltaylor" skrev i meddelelsen
...
Hi,

I would appreciate some help with the following. I am trying to enter
a sumproduct formula in VBA but using A1 notation instead of R1C1.
Could you someone provide me with an example.

Thanks



Bob Phillips

Sumproduct with A1 notation instead of R1C1
 
Activecell.Formula = "=SUMPRODUCT(--(A2:A20="value1"),--(B2:B20=17))

or

Set rng1 = Range("A2:A20")
Set rng2 = Range("B2:B20")

Activecell.Formula = "=SUMPRODUCT(--(" & rng1.Address & "),--(" &
rng2.Address & "))"


--
HTH

Bob

(there's no email, no snail mail, but somewhere should be gmail in my addy)

"sgltaylor" wrote in message
...
Hi,

I would appreciate some help with the following. I am trying to enter
a sumproduct formula in VBA but using A1 notation instead of R1C1.
Could you someone provide me with an example.

Thanks





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

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