Is it possible to return a value or a sum of values using segmented lookup criteria. The Sample 1 spreadsheet (attached) explains it better.
Grateful for any ideas.
Thanks
Is it possible to return a value or a sum of values using segmented lookup criteria. The Sample 1 spreadsheet (attached) explains it better.
Grateful for any ideas.
Thanks
Last edited by BRISBANEBOB; 06-10-2009 at 03:06 AM.
You could use a SUMPRODUCT such that:
This isn't a great approach, elegant but not particularly efficient.![]()
Please Login or Register to view this content.
I would personally advise you create a concatenation of B:D in A such that:
Then you can dispense with SUMPRODUCT and use a standard SUMIF which is far more efficient in the long run![]()
Please Login or Register to view this content.
![]()
Please Login or Register to view this content.
My Recommended Reading:
Volatility
Sumproduct & Arrays
Pivot Intro
Email from XL - VBA & Outlook VBA
Function Dictionary & Function Translations
Dynamic Named Ranges
Once again I find myself thanking you. Also for your list of reading material.
What part does the ISNUMBER play in the SUMPRODUCT formula?
It is used to evaluate the result of the SEARCH.
A SEARCH function will return a number if the criteria string is found - if not it will return an Error.
The ISNUMBER is used to manipulate the output of the SEARCH to a Boolean of True/False. If found and Search returned a Number the ISNUMBER returns TRUE, if not found and Search returned an Error value then ISNUMBER returns FALSE.
The Boolean output of the ISNUMBER is then coerced via double unary (--) to it's integer equivalent of 1 for TRUE and 0 for FALSE. These integers are subsequently used when calculating the Product.
You could try this
I assumed blank cell means any character?
copied down!![]()
Please Login or Register to view this content.
Regards
Darren
Update 12-Nov-2010 Still job hunting!
If you are happy with the results, please add to our reputation by clicking the blue scales icon in the blue bar of the post.
Learn something new each day, Embrace change do not fear it, evolve and do not become extinct!
I've used formula with the double unary and I sort of understand the way it works. I also understand (now that I've worked through the formula and read your response) how the ISNUMBER works. Why do some formula use the -- when your's doesnt need to?
To Squiggler47
That's also pretty neat!
Thanks
Sorry my bad - was on double unary auto pilot... doh.
In this instance we used * rather than -- as our coercer, put simply this is because in this instance our ranges are not of equal dimension, ie:
6x1
B4:B9, C4:C9, D4:D9
6x6
E4:J9
1x6
E3:J3
so a double unary approach is not viable here... when it is viable it is normally used as it's regarded as slightly more efficient... there are pros and cons to both methods (-- and *) ... the link in the Sig offers more info on the subject.
OK, with you.
Thanks again.
Just as a reference with this sheet all the formulas are fairly close in speed!
I also tried a mod of the sum if formula
RIGHT("*"&B15&":",2)&RIGHT("*"&C15&":",2)&RIGHT("*"&D15,1)
Rather than
IF($B15="","*",$B15)&":"&IF($C15="","*",$C15)&":"&IF($D15="","*",$D15)
SUMIF will be considerably quicker than Sumproduct/Array when used with very large ranges and/or in very large quantities (amplified if used in Volatile fashion) ... if the datasets are insignificant in size then there won't be a massive difference I agree.
There are currently 1 users browsing this thread. (0 members and 1 guests)
Bookmarks