Wrox Programmer Forums
Go Back   Wrox Programmer Forums > Microsoft Office > Excel VBA > Excel VBA
Excel VBA Discuss using VBA for Excel programming.
Welcome to the p2p.wrox.com Forums.

You are currently viewing the Excel VBA section of the Wrox Programmer to Programmer discussions. This is a community of software programmers and website developers including Wrox book authors and readers. New member registration was closed in 2019. New posts were shut off and the site was archived into this static format as of October 1, 2020. If you require technical support for a Wrox book please contact http://hub.wiley.com
Old February 1st, 2007, 07:38 AM
Authorized User
Join Date: Jan 2007
Posts: 10
Thanks: 0
Thanked 0 Times in 0 Posts
Default SUM and GROUP BY in vba


A simple problem but a difficult solution (at least for me).
I have two columns. In column A there are different codes that arrive multiple times and that are not sorted, in column B there are numbers.

What I would like to have is simply a new table with a sum of the numbers grouped by each single code. The codes should appear in a specific order.

Has it something to do with the database function DBSUM, or should everything be programmed?

Many thanks,
Old February 1st, 2007, 07:41 AM
Friend of Wrox
Join Date: Jun 2003
Posts: 173
Thanks: 0
Thanked 3 Times in 3 Posts

Use the worksheet function SUMIF. have a look in help (F1) if you don't know how to use it.


Old February 1st, 2007, 10:31 AM
Friend of Wrox
Join Date: Sep 2005
Posts: 812
Thanks: 1
Thanked 53 Times in 49 Posts

Just to add it to maccas

Use the evaluate like:

Function Evaluate_Usage()

sFN = "=SUMIF(A5:A7,>200,A7:A8)"

Evaluate= Evaluate(sFN)

End Sub

This will return the value


Old February 5th, 2007, 06:11 AM
Authorized User
Join Date: Jan 2007
Posts: 10
Thanks: 0
Thanked 0 Times in 0 Posts

thanks a lot,

Similar Threads
Thread Thread Starter Forum Replies Last Post
Can I in SQL group by week & sum the values (i.e. callagga SQL Language 2 May 16th, 2008 07:25 AM
sum group values based on cell criteria darkdestroyer Excel VBA 1 January 9th, 2008 09:13 PM
Sum a column at the group level? srussell705 SharePoint Development 0 October 3rd, 2007 08:40 AM
Group by , Sub Group by and Sum mateenmohd SQL Server 2000 1 March 29th, 2005 09:51 AM
GROUP BY Avg and Sum pinkandthebrain SQL Server 2000 3 July 14th, 2003 09:20 AM

Powered by vBulletin®
Copyright ©2000 - 2020, Jelsoft Enterprises Ltd.
Copyright (c) 2020 John Wiley & Sons, Inc.