PDA

View Full Version : Solved: Like DSUM function



Cass
12-28-2005, 07:27 AM
Hi!

DSUM is good function but i need us it without "labels" http://vbaexpress.com/forum/images/smilies/think.gif
Is any way to solve this with VBA?!

1 table lookup value and another table is several same value witch must SUM before output the lookup value

example find AA
AA 55
BB 20
AA 30
CC 10

Result: 85

Bob Phillips
12-28-2005, 10:15 AM
Hi!

DSUM is good function but i need us it without "labels" http://vbaexpress.com/forum/images/smilies/think.gif
Is any way to solve this with VBA?!

1 table lookup value and another table is several same value witch must SUM before output the lookup value

example find AA
AA 55
BB 20
AA 30
CC 10

Result: 85

How about



myVal = Application.SUMIF(Columns(1),"AA",Columns(2))

Norie
12-28-2005, 10:31 AM
Do you really need/want code?

Could you not just use the SUMIF worksheet function?

Cass
12-28-2005, 01:08 PM
no i dont need use code if is any another way but i dont find any good worksheet function :dunno

Norie
12-28-2005, 01:24 PM
What about SUMIF?

The code xld posted basically use's that.

The worksheet equivalent would be something like this.

=SUMIF(A:A,"AA",B:B)

You might also want to look into pivot tables.

Cass
12-28-2005, 01:28 PM
Jeh so easy thats it.
Case closed :friends: