View Single Post
  #4   Report Post  
Posted to microsoft.public.excel.worksheet.functions
Mike H Mike H is offline
external usenet poster
 
Posts: 11,501
Default how to check first 5 characters of a cell & then sum

Hi,

Forgot to mention that ght991 is 6 characters not 5

Mike

"Mike H" wrote:

Try

=SUMPRODUCT(--(LEFT(A1:A19,6)="ght991"),(B1:B19))

Mike

"jonny" wrote:

Hi,

I'm looking for a way to check the first 5 characters of a cell for a
certain value and if it equals that value to sum the value of another
cell e.g.

Column A, B,
ght991xyz, 10
ght887fht, 100
ght991xyz, 50
ght887fht, 7

So in the example above I'd want to check all rows where column A
starts with ght991 and then sums the value of column B. So the result
of the above would be 60 (50+10).. Not that column A will always
contain digits after the first five, but only the first 5 will match.

Any help would be greatly appreciated.

Best Regards