Advertisement

02.13.2002 at 08:21AM PST, ID: 20266370
[x]
Attachment Details
[x]
The Solution Rating System

With so many solutions, how can you tell which solutions are most likely to help you and which ones are not? To provide you with a tool to use, we rate our solutions based on various elements that most accurately determine if a solution is a quality solution. To explain what factors affect the solution rating, here are the elements we take into consideration when formulating our solution rating.

  • The Grade of the Solution
  • The Zone Rank of the Expert Providing the Solution
  • The Number of Author and Expert Comments
  • The Number of Experts Contributing
  • The Feedback of the Community

Your Input Matters
Because of the way the system is set up, the most important variable in this equation is you. As a member of Experts Exchange, you are able to cast your vote on the quality of the solutions in regard to how complete, accurate, helpful and easy to understand each solution is. When you provide your feedback, each rating is adjusted accordingly. So, if you see a solution that has a poor rating that you think is a good solution, let us know by rating it. As you do, the rating will be adjusted and will become more accurate for other members of our site.

If you have any suggestions that you would like to make for our rating system, please ask a question in the Suggestions Zone of Community Support.

Thank you!

7.6

Custom SumIf Function in Excel

Asked by michaelwadegreen in Microsoft Office Suite

Tags: ,

I am trying to create an Excel function in VBA that is similar to the SumIf() function.  The difference is that it evaluates two columns.  

Here is an example of the SumIf() Function:
SumIf(range,criteria,sum_range)

'Sum Col2 where Col1="X"
=SumIf(Col1,"X",Col2)

Col1  Col2
 a     5
 b     3
 X     2
 y     1
 X     4
 z     1

The result is:
SumIf()= 2 + 4 = 6

Easy enough.

***************
***************
Here is what I'm trying to create based on that function:
NewSumIf(range,criteria,defa_sum_range, sum_range)

'If Col3 is .null then use the value in Col2 otherwise
   use the value in Col3 where Col1="X"

=NewSumIf(Col1,"X",Col2,Col3)

Col1  Col2  Col3
 a     5     3
 b     3    
 X     2     5
 y     1     1
 X     4    
 z     1     6

The result should be:
NewSumIf()=5 + 4 = 9


I guess my first obstacle is selecting the columns from the Excel spreadsheet and getting them into an array.  I'm not sure how to do that (I can't get the function to see the range I've selected as an array).  After that, how do I evaluate the array and select the correct numbers to sum?  I'm thinking out loud... any input will be greatly appreciated.Start Free Trial
[+][-]02.13.2002 at 11:04AM PST, ID: 6800050

At Experts Exchange, members can ask their questions to thousands of technology professionals, also known as Experts. Experts compete and collaborate to answer those questions by leaving comments like this one.

Start your 7-day free trial to view this Expert Comment or ask the Experts your question.

 
[+][-]02.13.2002 at 12:15PM PST, ID: 6800238

Often, when Experts are collaborating with members who have asked questions, they will request additional information about the problem. Askers respond with an author comment like this one.

Start your 7-day free trial to view this Author Comment or ask the Experts your question.

 
[+][-]02.14.2002 at 01:16AM PST, ID: 6801590

View this solution now by starting your 7-day free trial. Setting up your free trial is quick, easy, and secure. We will return you to this solution, unlocked, when you're done.

 

About this solution

Zone: Microsoft Office Suite
Tags: sumif, sum_range
Sign Up Now!
Solution Provided By: forsbom
Participating Experts: 3
Solution Grade: A
 
 
[+][-]02.14.2002 at 04:55AM PST, ID: 6801893

At Experts Exchange, members can ask their questions to thousands of technology professionals, also known as Experts. Experts compete and collaborate to answer those questions by leaving comments like this one.

Start your 7-day free trial to view this Expert Comment or ask the Experts your question.

 
[+][-]02.14.2002 at 04:57AM PST, ID: 6801900

At Experts Exchange, members can ask their questions to thousands of technology professionals, also known as Experts. Experts compete and collaborate to answer those questions by leaving comments like this one.

Start your 7-day free trial to view this Expert Comment or ask the Experts your question.

 
[+][-]02.14.2002 at 11:34AM PST, ID: 6802810

Often, when Experts are collaborating with members who have asked questions, they will request additional information about the problem. Askers respond with an author comment like this one.

Start your 7-day free trial to view this Author Comment or ask the Experts your question.

 
[+][-]02.15.2002 at 12:58AM PST, ID: 6803615

At Experts Exchange, members can ask their questions to thousands of technology professionals, also known as Experts. Experts compete and collaborate to answer those questions by leaving comments like this one.

Start your 7-day free trial to view this Expert Comment or ask the Experts your question.

 
 
Loading Advertisement...
20080716-EE-VQP-32