Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1   Report Post  
Old April 10th 15, 02:14 AM posted to microsoft.public.excel.worksheet.functions
external usenet poster
 
First recorded activity by ExcelBanter: Jan 2014
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  
Old April 10th 15, 06:34 AM posted to microsoft.public.excel.worksheet.functions
external usenet poster
 
First recorded activity by ExcelBanter: Apr 2011
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,"C",E:E)


Regards
Claus B.
--
Vista Ultimate / Windows7
Office 2007 Ultimate / 2010 Professional
  #3   Report Post  
Old April 10th 15, 06:54 AM posted to microsoft.public.excel.worksheet.functions
external usenet poster
 
First recorded activity by ExcelBanter: Jan 2014
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,"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  
Old April 10th 15, 03:21 PM posted to microsoft.public.excel.worksheet.functions
external usenet poster
 
First recorded activity by ExcelBanter: Apr 2011
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  
Old April 10th 15, 07:47 PM posted to microsoft.public.excel.worksheet.functions
external usenet poster
 
First recorded activity by ExcelBanter: Jan 2014
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 multiple columns help duketter Excel Worksheet Functions 2 May 8th 10 08:44 AM
SUMIFs across multiple sheets kwyjibo jones Excel Worksheet Functions 7 August 13th 09 09:15 PM
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 08:19 PM.

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

About Us

"It's about Microsoft Excel"

 

Copyright © 2017