View Single Post
  #2   Report Post  
Posted to microsoft.public.excel.worksheet.functions
Harlan Grove Harlan Grove is offline
external usenet poster
 
Posts: 733
Default SUMIF, Text, and Leading, 000s

Stephen wrote...
I am having difficulty with using SUMIF over a range of text formatted
numbers. When my criteria is 0001234 it sums the corresponding values
associated with 01234, 1234 and 001234. Is there a way to further restrict
the summed values for only those item exactly matching 0001234?


Yes, the criteria expressions used by SUMIF and COUNTIF are quite
crude. If the criteria expression looks like a number, Excel treats it
as a numeric comparison. The only way to force Excel to make it a text
comparison is to use two function calls using different wildcards
added to the criteria expression. In this case,

=SUMIF(rngA,"0001234*",rngB)-SUMIF(rngA,"0001234?*",rngB)

Alternatively, use SUMPRODUCT.

=SUMPRODUCT(--(rngA="0001234"),rngB)