Forum Discussion
FIND AND COPY
- Dec 17, 2019Just tested your formula on the entire spreadsheet.
AMAZING! It works a treat.
Does exactly what I wanted.
Thank you so much for your help.
Been trying data tab followed by advanced but can't get the criteria right.
Is this a possibility?
- Kelly290Dec 17, 2019Copper ContributorTried your formula Sergei. works fine on records ending in pack of * but get #VALUE error for records that don't end in pack of *
- SergeiBaklanDec 17, 2019Diamond Contributor
That could be several variants, but the main point base on which logic to extract the number. My assumption was the qty is the number at the end of the text separated from it by space. Doesn't matter which text is before. We may wrap formula by IFERROR() for the case when there is no number at the end and return zero in such case:
as
=IFERROR(--RIGHT(A1,LEN(A1)-LOOKUP(2^10,SEARCH(" ",A1,ROW(INDIRECT("1:"&LEN(A1)))))),0)
For the same logic it could be other variants of formula, but for another logic it definitely shall be another formula.
- Kelly290Dec 17, 2019Copper ContributorI should add that if the record does not include pack of* then the quantity will be 1
- mathetesDec 17, 2019Silver Contributor
Here's a formula that works. Assume your text is in Cell B4, then this in C4 will get the number as a value:
=IFERROR(VALUE(RIGHT(B4,LEN(B4)-FIND("PACK OF",B4)-7)),1)
Now, it only works if "PACK OF" is always there and in caps. We could add an "OR" clause if it sometimes is in lower case.
And if there is no reference to "PACK OF" this returns the value 1.
See attached.