Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1   Report Post  
Posted to microsoft.public.excel.misc
external usenet poster
 
Posts: 54
Default Help, it's late and I am being thick

I have a load of data 368X104 cells.......
This data is sales data by day per site.

Within this is also an area number so fo example:
a b c
1 Site No1 Site No2
2 Area No Area No
3 date1 Sales Sales
4 date2 sales Sales
5 date3 sales Sales
all i want to do is sum by area the vlaue of sales per day, the simple
way is a {sum(if......))} but I can not make this work for horizontal
not verticle. I am sure ther is a sipmple way, if you transpose then
you hit the 256 difficulty...


If there is anybody awake please help me

Regards

Matthew
  #2   Report Post  
Posted to microsoft.public.excel.misc
Max Max is offline
external usenet poster
 
Posts: 9,221
Default Help, it's late and I am being thick

.. If there is anybody awake ..
Ah, half the world is awake at any one time

Assume real dates in A3:A10, Site#s in B1:C1, Area#s in B2:C2

If the Area#s are unique,
Assume that for an Area# input in A20
you want the total sales for Jan 2008

In B20, normal ENTER:
=SUMPRODUCT(--(TEXT(A3:A10,"mmmyy")="Jan08"),OFFSET(A3:A10,,MATC H(A20,B2:C2,0)))

If the Area#s are not unique, eg you may have the same area# in different
sites, then the uniqueness can be defined by using both Site# & Area#

In A20: Site#
In B20: Area#

Then in C20, normal ENTER:
=SUMPRODUCT(--(TEXT(A3:A10,"mmmyy")="Jan08"),OFFSET(A3:A10,,MATC H(A20&"#"&B20,B1:C1&"#"&B2:C2,0)))

Adapt to suit

P/s: For future new postings, pl use relevant phrases in your subject line
--
Max
Singapore
http://savefile.com/projects/236895
Downloads:17,800 Files:359 Subscribers:56
xdemechanik
---
"Matthew" wrote in message
...
I have a load of data 368X104 cells.......
This data is sales data by day per site.

Within this is also an area number so fo example:
a b c
1 Site No1 Site No2
2 Area No Area No
3 date1 Sales Sales
4 date2 sales Sales
5 date3 sales Sales
all i want to do is sum by area the vlaue of sales per day, the simple
way is a {sum(if......))} but I can not make this work for horizontal
not verticle. I am sure ther is a sipmple way, if you transpose then
you hit the 256 difficulty...


If there is anybody awake please help me

Regards

Matthew



  #3   Report Post  
Posted to microsoft.public.excel.misc
external usenet poster
 
Posts: 3,365
Default Help, it's late and I am being thick

Max has provided a formula that should work for you very well, if you'd like
to try it with a user defined function (UDF), I wrote one up for you. To put
it into a workbook, open the workbook, press [Alt]+[F11] to get into the VB
Editor, then choose Insert | Module from the VBE menu and copy and paste the
code into the module provided. Make any changes needed to the Const values
to match the layout of your worksheet. How to call it is included as
comments in the code:

Function SalesByAreaPerDay(SalesArea As Variant, _
SalesDate As Date) As Currency
'call from a worksheet cell as:
' manual inputs:
' =salesbyareaperday(5,"9/2/2008")
'using cell references with appropriate values, as
' =salesbyareaperday(A1,A2)
'where A1 contains area ID to match
'and A2 contains date to match

Const salesDatecol = "A" ' column with dates in it
Const firstAreaEntry = "B2"
Const firstDateEntry = "A3"

Dim lastColumn As Integer
Dim dateRow As Long
Dim datesList As Range
Dim anyDateEntry As Range
Dim areasList As Range
Dim anyAreaEntry As Range
Dim totalSales As Currency

'set default return value to zero
SalesByAreaPerDay = 0
'find out how many columns we have to look at
'assumes that area IDs are in row 2
'and that A2 is an empty cell, and first
'area ID is in B2
lastColumn = Range(firstAreaEntry).Offset(0, _
Columns.Count - Range(firstAreaEntry).Column). _
End(xlToLeft).Column
If lastColumn = 1 Then
lastColumn = Columns.Count
End If
Set areasList = Range(firstAreaEntry & ":" & _
Cells(Range(firstAreaEntry).Row, lastColumn).Address)

Set datesList = Range(firstDateEntry & ":" & _
Range(salesDatecol & Rows.Count).End(xlUp).Address)

dateRow = 0 ' initialize
'assumes each date is only entered once
For Each anyDateEntry In datesList
If anyDateEntry = SalesDate Then
dateRow = anyDateEntry.Row
Exit For
End If
Next
If dateRow = 0 Then
Exit Function
End If
'we have date match, find all
'area matches
For Each anyAreaEntry In areasList
If anyAreaEntry = SalesArea Then
SalesByAreaPerDay = _
SalesByAreaPerDay + Cells(dateRow, _
anyAreaEntry.Column)
End If
Next
End Function



"Matthew" wrote:

I have a load of data 368X104 cells.......
This data is sales data by day per site.

Within this is also an area number so fo example:
a b c
1 Site No1 Site No2
2 Area No Area No
3 date1 Sales Sales
4 date2 sales Sales
5 date3 sales Sales
all i want to do is sum by area the vlaue of sales per day, the simple
way is a {sum(if......))} but I can not make this work for horizontal
not verticle. I am sure ther is a sipmple way, if you transpose then
you hit the 256 difficulty...


If there is anybody awake please help me

Regards

Matthew

  #4   Report Post  
Posted to microsoft.public.excel.misc
external usenet poster
 
Posts: 3,365
Default Help, it's late and I am being thick

Oops, last minute change made boo-boo. Use this instead if you use it at all.

Function SalesByAreaPerDay(SalesArea As Variant, _
SalesDate As Date) As Currency
'call from a worksheet cell as:
' manual inputs:
' =salesbyareaperday(5,"9/2/2008")
'using cell references with appropriate values, as
' =salesbyareaperday(A1,A2)
'where A1 contains area ID to match
'and A2 contains date to match

Const salesDatecol = "A" ' column with dates in it
Const firstAreaEntry = "B2"
Const firstDateEntry = "A3"

Dim lastColumn As Integer
Dim dateRow As Long
Dim datesList As Range
Dim anyDateEntry As Range
Dim areasList As Range
Dim anyAreaEntry As Range
Dim totalSales As Currency

'set default return value to zero
SalesByAreaPerDay = 0
'find out how many columns we have to look at
'assumes that area IDs are in row 2
'and that A2 is an empty cell, and first
'area ID is in B2
lastColumn = Range(firstAreaEntry).Offset(0, _
Columns.Count - Range(firstAreaEntry).Column). _
End(xlToLeft).Column
If lastColumn <= Range(firstAreaEntry).Column Then
lastColumn = Columns.Count
End If
Set areasList = Range(firstAreaEntry & ":" & _
Cells(Range(firstAreaEntry).Row, lastColumn).Address)

Set datesList = Range(firstDateEntry & ":" & _
Range(salesDatecol & Rows.Count).End(xlUp).Address)

dateRow = 0 ' initialize
'assumes each date is only entered once
For Each anyDateEntry In datesList
If anyDateEntry = SalesDate Then
dateRow = anyDateEntry.Row
Exit For
End If
Next
If dateRow = 0 Then
Exit Function
End If
'we have date match, find all
'area matches
For Each anyAreaEntry In areasList
If anyAreaEntry = SalesArea Then
SalesByAreaPerDay = _
SalesByAreaPerDay + Cells(dateRow, _
anyAreaEntry.Column)
End If
Next
End Function

"Matthew" wrote:

I have a load of data 368X104 cells.......
This data is sales data by day per site.

Within this is also an area number so fo example:
a b c
1 Site No1 Site No2
2 Area No Area No
3 date1 Sales Sales
4 date2 sales Sales
5 date3 sales Sales
all i want to do is sum by area the vlaue of sales per day, the simple
way is a {sum(if......))} but I can not make this work for horizontal
not verticle. I am sure ther is a sipmple way, if you transpose then
you hit the 256 difficulty...


If there is anybody awake please help me

Regards

Matthew

  #5   Report Post  
Posted to microsoft.public.excel.misc
external usenet poster
 
Posts: 2,345
Default Help, it's late and I am being thick

"Max" wrote in message
...
.. If there is anybody awake ..

Ah, half the world is awake at any one time


Or in my case half-awake at any one time <g

--

Sandy
In Perth, the ancient capital of Scotland
and the crowning place of kings


Replace @mailinator.com with @tiscali.co.uk


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
Conditional Formatting - Thick Border? fedude Excel Worksheet Functions 6 February 23rd 10 03:28 PM
How to offset cell value from thick border lines? [email protected] Excel Discussion (Misc queries) 3 November 23rd 06 07:51 PM
Am I thick? lookup from table GDXAHD Excel Discussion (Misc queries) 4 June 10th 06 07:35 PM
Am I being thick? Spellbound New Users to Excel 6 March 23rd 06 01:34 AM
Simple one, its just that I'm thick! Moxy1980 Charts and Charting in Excel 2 October 21st 05 09:55 AM


All times are GMT +1. The time now is 07:29 PM.

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"