Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 3
Default SUM using Three ranges. Two Comparisons and the SUM Range

I have a problem creating a function like this:

MySUMIF(range1, condition2range1, range2,
condition2range2, sumRange) As Double

Because I have data like this:

A B C
1 Tree Owner Profit
2 Apple Shawn 5.325611365
3 Pear Edward 8.325687876
4 Cherry John 25.69556655
5 Apple John 2.565678955
6 Apple John 63.59654647
7 Pear Edward 5.996465456
8 Pear Shawn 3.567898


but i need to call this function on another sheet, example

=MySUMIF(Sheet1!$A$2:$A$8, "Apple", Sheet1! B$2:$B$8,
"John", Sheet1!C$2:C$8)

I know this function is really easy but how can I use the
three ranges at the same time to get the sum and make the
respective comparisons.

I try using three diferent "for" statements but It makes
my algorithm O(n)^3, what I need - I think - is how to use
the three ranges in one "for" statement


For Each rng,rgn2,rgn3 in myRange1, myRange2, myRange3
....
Next rng

I have been tring to use the Offset property but I seems
no work to me.


If anyone knows how can I have every value on the
respective range.
PLEASE HELPME.


Thanks In Advace.

czamora.


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
Join non-contiguous ranges into one range via named range? ker_01 Excel Discussion (Misc queries) 3 May 1st 09 11:09 AM
x y scatter chart series ranges reset to x(range) = y(range) Brakerm19 Charts and Charting in Excel 4 September 26th 06 11:13 PM
Charting only Used Range with Named Ranges cooter24 Charts and Charting in Excel 3 January 27th 06 03:00 AM
How to replicate 1 range to muptiple ranges at once? Ann Excel Worksheet Functions 1 January 4th 06 08:07 PM
Assigning ranges for values (e.g., $1,005 the range is ">$1K to 5K jennifer Excel Worksheet Functions 1 August 11th 05 02:09 PM


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