Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 694
Default Summarize sales data

Max,

It is probably best to split the column a and b into two columns say b and c
where b is the product group and b is the product. This can be done my having
a product group list on another worksheet and running a simple macro to split
the columns:

I called the product group sheet products and it was in the same workbook
as the sales lines.

With the sales lines worksheet open run the following macro. Not there are
no headings.

After you have run it make a pivot table report or use the products with a
sumif.

'---------------------------------------------
Option Explicit

Sub split()

Dim line As Range
Dim pg As Range

Dim foundit As Boolean

ActiveSheet.Columns("b:c").Insert ' add 2 columns
For Each line In ActiveSheet.Range("A1").CurrentRegion
foundit = False
' search products
For Each pg In ActiveWorkbook.Worksheets("products") _
.Range("A1").CurrentRegion
If InStr(1, line.Value, pg.Value, vbTextCompare) = 1 Then
'insert values
line.Offset(0, 1) = pg.Value
line.Offset(0, 2) = Trim(Mid(line.Value, Len(pg.Value) _
+ 1, Len(line.Value)))
foundit = True
Exit For
End If
Next pg
If Not foundit Then ' didn't find it
line.Offset(0, 1) = "Unknown"
line.Offset(0, 2) = line.Value
End If
Next line
Set pg = Nothing
Set line = Nothing
End Sub
'------------------------------------------------------------

--
Hope this helps
Martin Fishlock


"Max Bialystock" wrote:

I have in columns a & b imported data such as the following:
Book Labels Hummingbird Secret Garden Series 2
Book Labels Il Gatto Secret Garden Series 1
Book Labels Red Wren Secret Garden Series 1
Decoration Christmas Dove Red 1
Ham Bag Carlas 1
Mug Medina Casablanca Series 1
Mug Midnight Peacock Series 1
Tea Towel Spring Chickens Meadows Series 1
Tea Towel Marrakech Signature Series 1


Column A has the item name
Column B has the number sold

How can I get the totals for Book Labels, Decoration, Mugs etc?



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
copy sales volume data from sheet 2 to sheet 1 by sales person pm Excel Discussion (Misc queries) 1 November 4th 09 09:11 PM
Summarize data Chris Excel Discussion (Misc queries) 1 April 28th 09 09:24 PM
Sales Order to Sales History Data Koomba Excel Worksheet Functions 0 October 2nd 08 01:09 AM
Linking Sales Order to Sales History Data Koomba Excel Worksheet Functions 6 September 30th 08 06:06 AM
Summarize Data kgsggilbert Excel Discussion (Misc queries) 1 June 8th 05 09:41 PM


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

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

About Us

"It's about Microsoft Excel"