View Single Post
  #4   Report Post  
Posted to microsoft.public.excel.worksheet.functions
T. Valko T. Valko is offline
external usenet poster
 
Posts: 15,768
Default Sum delimited values in text string if...

Try this:

Array entered:

=SUM(IF(ISNUMBER(FIND("1x",B10:BD10)),--MID(B10:BD10,FIND("x",B10:BD10)+1,10)))

FIND is case sensitive so the formula is looking for lower case "x". If you
might have both "x" or "X" then replace FIND with SEARCH.

Biff

"J" wrote in message
...
Elkar,

Thanks! This works fine with one exception. If the number to the left of
the
"x" more than one digit long it does not appear to sum the number to the
right of the "x". Any suggestions to fix this?

"Elkar" wrote:

See if this works for you:

=SUM(IF(LEFT(B10:BD10,2)="1x",--MID(B10:BD10,3,99),0))

This is an array formula, so should be entered with CTRL-SHIFT-ENTER
rather
than just Enter. If done properly, the formula should be surround by
{ }.

HTH,
Elkar


"J" wrote:

I would like to be able to sum numbers from a portion of a text string
if the
number meets a condition. The cells of data are in a row. The data
looks like
the following:
1x1.5
21x9
3x2

The number of digits is not a fixed length. The "x" consistently
delimits
the numbers.

This formula is to give me the value of the right number if the left
number
= 1. It seems to work fine.
=SUMPRODUCT((LEFT(B10,FIND("x",B10)-1)="1")*(RIGHT(B10,LEN(B10)-FIND("x",B10))))

I need to be able to sum all the right numbers when the value of the
left
number = 1 over a range of cells, B10:BD10. When I use the formula
below I
get a #Value! error:
=SUMPRODUCT((LEFT(B10:BD10,FIND("x",B10:BD10)-1)="1")*(RIGHT(B10:BD10,LEN(B10:BD10)-FIND("x",B10:BD10))))

Can anyone tell me what I can do to make the formula work?

Thanks