ExcelBanter

ExcelBanter (https://www.excelbanter.com/)
-   Excel Programming (https://www.excelbanter.com/excel-programming/)
-   -   DSUM? (https://www.excelbanter.com/excel-programming/377047-dsum.html)

HSalim[MVP]

DSUM?
 
Hi,
I have this line in my code
x = Application.VLookup(Cells(K, J).Value, rng, 4,
False)
Till recently,this was good - it was alwas a one to one/none match

Now it has become a one to Many so I need to change it to be a sum
I need the approximate equivalent of
Application.DSUM( rng, "QTY", "ItemNmbr = " & Cells(K,
J).Value)
This statement returns error 2015.

How can I get this to work?


Thanks in advance for your assistance
Regrds
Habib





--
www.DynExtra.com
A resource for the Microsoft Dynamics Community
Featuring FAQs, File Exchange and more
Current member count: 40
--------------------------------------------
Share your knowledge. Add your favorite questions and answers
Help add questions to this site! We want Your input.
--------------------------------------------



Bob Phillips

DSUM?
 
Habib,

use SUMIF

x = Application.SUMIF(rng, Cells(K, J).Value, rng_to_sum)

--
HTH

Bob Phillips

(replace somewhere in email address with gmail if mailing direct)

"HSalim[MVP]" wrote in message
...
Hi,
I have this line in my code
x = Application.VLookup(Cells(K, J).Value, rng, 4,
False)
Till recently,this was good - it was alwas a one to one/none match

Now it has become a one to Many so I need to change it to be a sum
I need the approximate equivalent of
Application.DSUM( rng, "QTY", "ItemNmbr = " & Cells(K,
J).Value)
This statement returns error 2015.

How can I get this to work?


Thanks in advance for your assistance
Regrds
Habib





--
www.DynExtra.com
A resource for the Microsoft Dynamics Community
Featuring FAQs, File Exchange and more
Current member count: 40
--------------------------------------------
Share your knowledge. Add your favorite questions and answers
Help add questions to this site! We want Your input.
--------------------------------------------





HSalim[MVP]

DSUM?
 
Thanks Bob!
HS


--
www.DynExtra.com
A resource for the Microsoft Dynamics Community
Featuring FAQs, File Exchange and more
Current member count: 40
--------------------------------------------
Share your knowledge. Add your favorite questions and answers
Help add questions to this site! We want Your input.
--------------------------------------------
"Bob Phillips" wrote in message
...
Habib,

use SUMIF

x = Application.SUMIF(rng, Cells(K, J).Value, rng_to_sum)

--
HTH

Bob Phillips

(replace somewhere in email address with gmail if mailing direct)

"HSalim[MVP]" wrote in message
...
Hi,
I have this line in my code
x = Application.VLookup(Cells(K, J).Value, rng,
4,
False)
Till recently,this was good - it was alwas a one to one/none match

Now it has become a one to Many so I need to change it to be a sum
I need the approximate equivalent of
Application.DSUM( rng, "QTY", "ItemNmbr = " & Cells(K,
J).Value)
This statement returns error 2015.

How can I get this to work?


Thanks in advance for your assistance
Regrds
Habib





--
www.DynExtra.com
A resource for the Microsoft Dynamics Community
Featuring FAQs, File Exchange and more
Current member count: 40
--------------------------------------------
Share your knowledge. Add your favorite questions and answers
Help add questions to this site! We want Your input.
--------------------------------------------








All times are GMT +1. The time now is 06:57 PM.

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