Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 5
Default Macro Needed Please

Hi All

I hope that someone can help with my problem.
On "Sheet1" I have two columns, A = Code, B =Qty.
What happens is that i extract a large amount of data from a database to my
excel worksheet.
These columns spoken about above, hold my information. What i need is a
summary of this information, let me explain with an example. Let us say i'm
looking @ product "a", wich has the code "a". When i pull information out of
the database there might be 20 rows of product "a". I need a macro that adds
all the quantities (column B) for all instances of product "a", and puts the
sum of those quantities into "Sheet2" Cell "B1", with the code next to it on
Cell "A1". The macro then needs to look at the next item and place the
results under the previous ones on "sheet2".

I hope i have explained the problem in an undersandable way!
Thanks in advance
Ant




  #2   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 5,441
Default Macro Needed Please

Ant,

Select your data table, and use Data | Pivot Table. Drag the code to the
row field, and the Qty to the data field, and set the Qty to return a sum,
and you're done.

Look in help for more on Pivot Tables.

HTH,
Bernie
MS Excel MVP


"Ant Nutting" wrote in message
...
Hi All

I hope that someone can help with my problem.
On "Sheet1" I have two columns, A = Code, B =Qty.
What happens is that i extract a large amount of data from a database to

my
excel worksheet.
These columns spoken about above, hold my information. What i need is a
summary of this information, let me explain with an example. Let us say

i'm
looking @ product "a", wich has the code "a". When i pull information out

of
the database there might be 20 rows of product "a". I need a macro that

adds
all the quantities (column B) for all instances of product "a", and puts

the
sum of those quantities into "Sheet2" Cell "B1", with the code next to it

on
Cell "A1". The macro then needs to look at the next item and place the
results under the previous ones on "sheet2".

I hope i have explained the problem in an undersandable way!
Thanks in advance
Ant






  #3   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 11,272
Default Macro Needed Please

Put the code in A1

In B1

=SUMIF(Sheet1!A:A,A1,Sheet1!B:B)

--

HTH

Bob Phillips
... looking out across Poole Harbour to the Purbecks
(remove nothere from the email address if mailing direct)

"Ant Nutting" wrote in message
...
Hi All

I hope that someone can help with my problem.
On "Sheet1" I have two columns, A = Code, B =Qty.
What happens is that i extract a large amount of data from a database to

my
excel worksheet.
These columns spoken about above, hold my information. What i need is a
summary of this information, let me explain with an example. Let us say

i'm
looking @ product "a", wich has the code "a". When i pull information out

of
the database there might be 20 rows of product "a". I need a macro that

adds
all the quantities (column B) for all instances of product "a", and puts

the
sum of those quantities into "Sheet2" Cell "B1", with the code next to it

on
Cell "A1". The macro then needs to look at the next item and place the
results under the previous ones on "sheet2".

I hope i have explained the problem in an undersandable way!
Thanks in advance
Ant






Reply
Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes

Posting Rules

Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On


Similar Threads
Thread Thread Starter Forum Replies Last Post
Macro Help Needed - Excel 2007 - Print Macro with Auto Sort Gavin Excel Worksheet Functions 0 May 17th 07 01:20 PM
Macro Help needed tamato43 Excel Discussion (Misc queries) 1 August 19th 05 01:48 AM
Macro needed Randall Roberts Excel Worksheet Functions 1 June 16th 05 11:52 PM
Macro needed to Paste Values and prevent Macro operation thunderfoot Excel Discussion (Misc queries) 1 June 11th 05 12:44 AM
Macro needed to Paste Values and prevent Macro operation thunderfoot Excel Discussion (Misc queries) 0 June 10th 05 03:38 PM


All times are GMT +1. The time now is 10:16 AM.

Powered by vBulletin® Copyright ©2000 - 2024, Jelsoft Enterprises Ltd.
Copyright ©2004-2024 ExcelBanter.
The comments are property of their posters.
 

About Us

"It's about Microsoft Excel"