Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1   Report Post  
Posted to microsoft.public.excel.worksheet.functions
external usenet poster
 
Posts: 852
Default SUMIFS ? for multiple ranges


The formula to sum "C" in these four tables escapes me, if it is even possible.
My SUMIF, SUMIFS & SUMPRODUCT search comes up with no "four-way" solution.

Assume Columns A - B & D - E.

Where the sum of "C" would = 18.

Howard


Table 1 Table 2
A 4 X 7
B 3 Y 6
C 8 Z 3


Table 3 Table 4
B 1 C 8
C 2 X 7
D 5 Y 9
  #2   Report Post  
Posted to microsoft.public.excel.worksheet.functions
external usenet poster
 
Posts: 3,872
Default SUMIFS ? for multiple ranges

Hi Howard,

Am Thu, 9 Apr 2015 18:14:36 -0700 (PDT) schrieb L. Howard:

Table 1 Table 2
A 4 X 7
B 3 Y 6
C 8 Z 3


Table 3 Table 4
B 1 C 8
C 2 X 7
D 5 Y 9


do it with multiple ranges:
=SUMIF(A:A,"C",B:B)+SUMIF(D:D,"C",E:E)


Regards
Claus B.
--
Vista Ultimate / Windows7
Office 2007 Ultimate / 2010 Professional
  #3   Report Post  
Posted to microsoft.public.excel.worksheet.functions
external usenet poster
 
Posts: 852
Default SUMIFS ? for multiple ranges

On Thursday, April 9, 2015 at 10:34:54 PM UTC-7, Claus Busch wrote:
Hi Howard,

Am Thu, 9 Apr 2015 18:14:36 -0700 (PDT) schrieb L. Howard:

Table 1 Table 2
A 4 X 7
B 3 Y 6
C 8 Z 3


Table 3 Table 4
B 1 C 8
C 2 X 7
D 5 Y 9


do it with multiple ranges:
=SUMIF(A:A,"C",B:B)+SUMIF(D:D,"C",E:E)


Regards
Claus B.


Okay, just thought there might be an "inclusive" kind of formula.

This will do, and if there were too many of these ranges I suppose one could resort to code.

Thanks Claus.

Howard
  #4   Report Post  
Posted to microsoft.public.excel.worksheet.functions
external usenet poster
 
Posts: 3,872
Default SUMIFS ? for multiple ranges

Hi Howard,

Am Thu, 9 Apr 2015 22:54:47 -0700 (PDT) schrieb L. Howard:

This will do, and if there were too many of these ranges I suppose one could resort to code.


if your table layout is always one column with characters, one with
digits and one blank and so on, you could use this UDF:

Function mySumIf(myRng As Range, strCheck As String) As Double
Dim i As Long, j As Long
Dim varData As Variant

varData = myRng

For i = 1 To UBound(varData)
For j = 1 To myRng.Columns.Count - 1 Step 3
If varData(i, j) = strCheck Then
mySumIf = mySumIf + varData(i, j + 1)
End If
Next
Next
End Function

And call the function in the sheet with
=mySumIf(A1:K8,"C")
or
=mySumIf(A1:K8,A3) if C is in A3


Regards
Claus B.
--
Vista Ultimate / Windows7
Office 2007 Ultimate / 2010 Professional
  #5   Report Post  
Posted to microsoft.public.excel.worksheet.functions
external usenet poster
 
Posts: 852
Default SUMIFS ? for multiple ranges

On Friday, April 10, 2015 at 7:21:10 AM UTC-7, Claus Busch wrote:
Hi Howard,

Am Thu, 9 Apr 2015 22:54:47 -0700 (PDT) schrieb L. Howard:

This will do, and if there were too many of these ranges I suppose one could resort to code.


if your table layout is always one column with characters, one with
digits and one blank and so on, you could use this UDF:

Function mySumIf(myRng As Range, strCheck As String) As Double
Dim i As Long, j As Long
Dim varData As Variant

varData = myRng

For i = 1 To UBound(varData)
For j = 1 To myRng.Columns.Count - 1 Step 3
If varData(i, j) = strCheck Then
mySumIf = mySumIf + varData(i, j + 1)
End If
Next
Next
End Function

And call the function in the sheet with
=mySumIf(A1:K8,"C")
or
=mySumIf(A1:K8,A3) if C is in A3


Regards
Claus B.
--


Indeed! Very clever.

Thanks.
Howard


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
SUMIFs across multiple sheets kwyjibo jones Excel Worksheet Functions 8 April 4th 23 02:30 PM
sumifs multiple columns help duketter Excel Worksheet Functions 2 May 8th 10 08:44 AM
Multiple Sumifs Emeryville John Excel Worksheet Functions 1 September 19th 08 10:12 PM
SumifS Multiple Sum Ranges dee Excel Worksheet Functions 2 May 23rd 07 08:42 PM
SumifS Multiple Sum Ranges Harlan Grove[_2_] Excel Worksheet Functions 0 May 23rd 07 08:40 PM


All times are GMT +1. The time now is 09:47 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"