View Single Post
  #4   Report Post  
Posted to microsoft.public.excel.worksheet.functions
Bob Phillips Bob Phillips is offline
external usenet poster
 
Posts: 10,593
Default SUMIF and LEFT and Named Ranges

It works by creating an array of values from the AccNo range that are
stripped down to the same number of characters as B6.

The LEFT(AccNo,LEN(B6)) will return an array of string values, so the --
before that is used to coerce these values into numbers, which are then
compared against B6, --LEFT(AccNo,LEN(B6))=B6. This returns an array of
True/False, so the other -- is used to coerce this to an array of 1/0, which
is then multiplied by the range AugustP to get the sum of matching values.
--
HTH

Bob Phillips

(replace somewhere in email address with gmail if mailing direct)

"DaveMoore" wrote in message
ups.com...
Thanks for this Bob.
Sorry about the duplicated postings.
On reflection, I think it may have happened when I hit the back and
forward buttons on my browser. Won't do that again!

It works! (as if you had any doubts). Why does it work? What do the
double hyphens do?

Bob Phillips wrote:
=-SUMPRODUCT(--(--LEFT(AccNo,LEN(B6))=B6),AugustP)