Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1   Report Post  
Posted to microsoft.public.excel.programming
m m is offline
external usenet poster
 
Posts: 64
Default 2 dimension summing (sumifs with 2 axis?)

I am looking for a formula that will allow me to, for a row that meets a
given criteria, add all the columns together that meet another criteria.

For example, how can I add the value of the "A" columns in the "Alpha" row.

A B A B
Alpha 10 400 60 100
Beta 20 200 50 200
Delta 30 250 70 150

Of course my real data set contains hundreds of rows and dozens of columns,
with more row and columns being added every month.
  #2   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 915
Default 2 dimension summing (sumifs with 2 axis?)

M wrote:
I am looking for a formula that will allow me to, for a row that meets a
given criteria, add all the columns together that meet another criteria.

For example, how can I add the value of the "A" columns in the "Alpha" row.

A B A B
Alpha 10 400 60 100
Beta 20 200 50 200
Delta 30 250 70 150

Of course my real data set contains hundreds of rows and dozens of columns,
with more row and columns being added every month.



Do you need a VBA solution? This might do it:

Sub WksSumProduct()
Dim ColLabel As String
Dim RowLabel As String
Dim Arg As String

ColLabel = "A"
RowLabel = "Alpha"
Arg = "(($B$1:$E$1=" & """" & ColLabel & """" & _
")*($A2:$A4=" & """" & RowLabel & """" & _
")*($B$2:$E$4))"
Debug.Print Evaluate("Sumproduct" & Arg)
End Sub

This is the same as the worksheet function
=SUMPRODUCT(($B$1:$E$1="A")*($A2:$A4="Alpha")*($B2 :$E4))
  #3   Report Post  
Posted to microsoft.public.excel.programming
m m is offline
external usenet poster
 
Posts: 64
Default 2 dimension summing (sumifs with 2 axis?)

That's sumproduct formula works perfectly. That sumproduct is a strange bird.

Thanks a ton!


"smartin" wrote:

M wrote:
I am looking for a formula that will allow me to, for a row that meets a
given criteria, add all the columns together that meet another criteria.

For example, how can I add the value of the "A" columns in the "Alpha" row.

A B A B
Alpha 10 400 60 100
Beta 20 200 50 200
Delta 30 250 70 150

Of course my real data set contains hundreds of rows and dozens of columns,
with more row and columns being added every month.



Do you need a VBA solution? This might do it:

Sub WksSumProduct()
Dim ColLabel As String
Dim RowLabel As String
Dim Arg As String

ColLabel = "A"
RowLabel = "Alpha"
Arg = "(($B$1:$E$1=" & """" & ColLabel & """" & _
")*($A2:$A4=" & """" & RowLabel & """" & _
")*($B$2:$E$4))"
Debug.Print Evaluate("Sumproduct" & Arg)
End Sub

This is the same as the worksheet function
=SUMPRODUCT(($B$1:$E$1="A")*($A2:$A4="Alpha")*($B2 :$E4))

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
multi dimension/axis single series bar chart larry garka Charts and Charting in Excel 0 November 1st 09 01:20 AM
Combining Single Dimension to Multi Dimension Array Stathy K Excel Programming 5 February 17th 09 06:18 PM
create a 3 dimension axis graph PH2 Charts and Charting in Excel 0 March 11th 08 10:30 PM
How to insert X axis scale values next to axis and X axis grid lin vp23larry Charts and Charting in Excel 2 June 23rd 05 03:45 PM
Array transfer - 1 dimension v. 2 dimension JWolf[_2_] Excel Programming 2 June 29th 04 01:02 AM


All times are GMT +1. The time now is 08:03 PM.

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"