Assuming your data will always be in the form of a number, followed by a space,
followed by the size, and with your cells 1 through 5 above in column A, put the
following array formula (commit with CTRL+SHIFT+ENTER) in B1:
=SUM(IF(TRIM(RIGHT(SUBSTITUTE(A1:A5," ",REPT(" ",9)),9))="xs",
--TRIM(LEFT(SUBSTITUTE(A1:A5," ",REPT(" ",9)),9)),0))
Or, with the size in C1 ("xs" for example, but without the quote marks), put
this array formula in B1:
=SUM(IF(ISNUMBER(FIND(" "&C1&" ",A1:A5&" ")),
--TRIM(LEFT(SUBSTITUTE(A1:A5," ",REPT(" ",9)),9)),0))
This is a classic example of 'I wouldn't start from here if I was you!!'.
With hindsight you are probably now aware you should keep numbers and text in
seperate cell if you want to easily do maths on them.
However, this assumes the space between the numbers and the text in your
sample data actually exists
=SUMPRODUCT((MID(A1:A5,FIND(" ",A1)+1,256)="xs")*(LEFT(A1:A5,FIND(" ",A1)-1)))
Mike
HTH,
Ryan--
--
Ryan---
If this information was helpful, please indicate this by clicking ''Yes''.
HTH,
Ryan--
--
Ryan---
If this information was helpful, please indicate this by clicking ''Yes''.
Select column B.
Data|Text to columns
delimited by space
and plop the output into column C (keep the original data if you want)
Then I could use:
=sumif(d:d,"xs",c:c)
And if I needed that combined cell, I'd recombine columns C and D with a
formula:
=c1&" "&d1
and drag down.
And I'd make sure any updates were in the quantity and type fields--not that
original format.
--
Dave Peterson
use CSE