ExcelBanter

ExcelBanter (https://www.excelbanter.com/)
-   Excel Programming (https://www.excelbanter.com/excel-programming/)
-   -   Dynamic Named Range (https://www.excelbanter.com/excel-programming/439192-dynamic-named-range.html)

Len

Dynamic Named Range
 
Hi,

In excel vba, how to set dynamic named range so that it can use in
sumif excel formula

E.g.

=SUMIF(Acct, "Total*", xxx)-SUMIF(Acct, "Expenses*",yyy)*-2

Acct refer to named range in column A
xxx refer to dynamic named range in column C
yyy refer to dynamic named range in column D

Can anyone help and thanks in advance

Regards
Len

Roger Govier[_3_]

Dynamic Named Range
 
Hi Len

If Acct has been defined and is in column A, then range for column C would
be
Offset(Acct, 0, 2)
and for column D would be
Offset(Acct, 0, 3)

SUMIF(Acct, "Total*", Offset(Acct, 0, 2))-SUMIF(Acct,
"Expenses*",Offset(Acct, 0, 3))*-2

--
Regards
Roger Govier

"Len" wrote in message
...
Hi,

In excel vba, how to set dynamic named range so that it can use in
sumif excel formula

E.g.

=SUMIF(Acct, "Total*", xxx)-SUMIF(Acct, "Expenses*",yyy)*-2

Acct refer to named range in column A
xxx refer to dynamic named range in column C
yyy refer to dynamic named range in column D

Can anyone help and thanks in advance

Regards
Len

__________ Information from ESET Smart Security, version of virus
signature database 4833 (20100203) __________

The message was checked by ESET Smart Security.

http://www.eset.com




__________ Information from ESET Smart Security, version of virus signature database 4833 (20100203) __________

The message was checked by ESET Smart Security.

http://www.eset.com




Bob Phillips[_4_]

Dynamic Named Range
 
LastRow = Cells(Rows.Count, "A")End(xlUp).Row

Range(Range("A2"), Cells(LastRow, "A")).Name = "Acct"

HTH

Bob

"Len" wrote in message
...
Hi,

In excel vba, how to set dynamic named range so that it can use in
sumif excel formula

E.g.

=SUMIF(Acct, "Total*", xxx)-SUMIF(Acct, "Expenses*",yyy)*-2

Acct refer to named range in column A
xxx refer to dynamic named range in column C
yyy refer to dynamic named range in column D

Can anyone help and thanks in advance

Regards
Len




Bob Phillips[_4_]

Dynamic Named Range
 
That should be a dot (.)

Bob

"Bob Phillips" wrote in message
...
LastRow = Cells(Rows.Count, "A")End(xlUp).Row

Range(Range("A2"), Cells(LastRow, "A")).Name = "Acct"

HTH

Bob

"Len" wrote in message
...
Hi,

In excel vba, how to set dynamic named range so that it can use in
sumif excel formula

E.g.

=SUMIF(Acct, "Total*", xxx)-SUMIF(Acct, "Expenses*",yyy)*-2

Acct refer to named range in column A
xxx refer to dynamic named range in column C
yyy refer to dynamic named range in column D

Can anyone help and thanks in advance

Regards
Len






Len

Dynamic Named Range
 
Hi Roger, Bob

Thanks a lot your formula and both work great!.......



Best Regards
Len




All times are GMT +1. The time now is 03:21 AM.

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