Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 108
Default dependant summing

Hello,
I would like to sum some numbers. But depending on 2 other column.
Say I have 3 named ranges.
the A column, B column and c column. = Range1, Range2, Range3

Range3 (column C) has numbers. Range 1, 2 are strings.

If I wanted to sum numbers in Range3 when Range1 = "ABC" and Range2 = "DEF"

do you use Sum (Range1="ABC....
Or do I need If statments?

thanks for any help


  #2   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 2,420
Default dependant summing

=SUMPRODUCT(--(Range1="ABC"),--(Range2="DEF"),Range3)

--
__________________________________
HTH

Bob

"greg" wrote in message
...
Hello,
I would like to sum some numbers. But depending on 2 other column.
Say I have 3 named ranges.
the A column, B column and c column. = Range1, Range2, Range3

Range3 (column C) has numbers. Range 1, 2 are strings.

If I wanted to sum numbers in Range3 when Range1 = "ABC" and Range2 =
"DEF"

do you use Sum (Range1="ABC....
Or do I need If statments?

thanks for any help



  #3   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 108
Default dependant summing

thanks for the help.
If I wanted to move this to vba code. I would think something like this
would work.
However, I get an object does not support this method.

Any ideas on moving to VBA?


Sub test()

Dim x
x = Excel.WorksheetFunction.SumProduct(--(Excel.ActiveWorkbook("Range1") =
"ABC"), --(Excel.ActiveWorkbook("Range2") = "DEF"),
Excel.ActiveWorkbook("Range3"))

End Sub






"Bob Phillips" wrote in message
...
=SUMPRODUCT(--(Range1="ABC"),--(Range2="DEF"),Range3)

--
__________________________________
HTH

Bob

"greg" wrote in message
...
Hello,
I would like to sum some numbers. But depending on 2 other column.
Say I have 3 named ranges.
the A column, B column and c column. = Range1, Range2, Range3

Range3 (column C) has numbers. Range 1, 2 are strings.

If I wanted to sum numbers in Range3 when Range1 = "ABC" and Range2 =
"DEF"

do you use Sum (Range1="ABC....
Or do I need If statments?

thanks for any help





  #4   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 3,101
Default dependant summing

this is an array formula, so press Ctrl+Shift+Enter after pasting it into a
cell
=SUM((A1:A10="ABC")*(B1:B10="DEF")*C1:C10)


"greg" wrote:

Hello,
I would like to sum some numbers. But depending on 2 other column.
Say I have 3 named ranges.
the A column, B column and c column. = Range1, Range2, Range3

Range3 (column C) has numbers. Range 1, 2 are strings.

If I wanted to sum numbers in Range3 when Range1 = "ABC" and Range2 = "DEF"

do you use Sum (Range1="ABC....
Or do I need If statments?

thanks for any help



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
v look value dependant on 2 cells Tacklemom Excel Discussion (Misc queries) 2 May 20th 09 11:17 PM
3 way dependant lists stratmyster Excel Worksheet Functions 3 July 24th 06 05:21 PM
Dependant Lists Steve Bladon Excel Discussion (Misc queries) 2 June 13th 05 12:28 PM
Dependant Combobox MBlake Excel Programming 4 April 28th 05 12:01 AM
second combo box will be dependant Noctos Excel Programming 4 December 29th 03 06:59 PM


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