Monday 28 January 2019

worksheet function - Excel 2010 formula to strip out part of cells


I have used basic IF ISNUMBER functions before to identify parts of cells and return the value in a different cell, such as:


=IF(ISNUMBER(VALUE(RIGHT(B5,1))),"",IF(ISNUMBER(VALUE(MID(B5,LEN(B5)-1,1))),RIGHT(B5,1),RIGHT(B5,2)))

How can i adapt this formula to look for a number/txt value and strip it out? Or would it be better to write new formula? Feel free to tell me where i've gone wrong previously! ;)


Note: the above formula isn't for the data below


Here is an example of the cell contents, I want to strip out the sizes (3L, 10L etc), the 'BARE ROOT' / 'ROOT BALL' / 'FEATHERED' and Girth sizes leaving only the names remaining.


ACANTHUS spinosus                  3L
ACANTHUS spinosus 3L
ACER campestre 10L
ACER campestre 3L
ACER campestre BARE ROOT 14/16GIRTH
ACER campestre BARE ROOT 150/175cm
ACER campestre BARE ROOT 30/40cm
ACER campestre BARE ROOT 40/60cm
ACER campestre BARE ROOT 60/80cm
ACER campestre BARE ROOT 80/100cm
ACER campestre BARE ROOT 80/100cm
ACER campestre BARE ROOT 80/100cm
ACER campestre BARE ROOT 80/100cm
ACER campestre 'Elsrijk' ROOT BALL 10/12GIRTH
ACER campestre 'Elsrijk' ROOT BALL 14/16GIRTH
ACER japonicum 'Aconitifolium' 10L 125/150cm
ACER japonicum 'Aconitifolium' 10L 60/80cm
ACER negundo 'Flamingo' 50L 200/250cm
ACER p. d. 'Dissectum Atropurpurea'70L 16/18GIRTH
ACER p. d. 'Dissectum Palmatifidum'25L FEATHERED
ACER p. d. 'Dissectum Palmatifidum'25L FEATHERED

More info
Looking through the sheet, the maxium name length is 35 characters, anything after that is size related and stripable, so some code to strip out after character 35 would be enough, then something to remove instances of more than 1 space would suffice...


Method 1
I've used {=LEFT(C2, MATCH(TRUE,ISNUMBER(1*MID(C2, ROW($1:$65), 1)),0)-1)} which is close to what i need, now just a way to identify the BARE ROOT and ROOT BALL, C2 is my cell... Also want it to not report 'ERROR' when no number is found... :)


Method 2 (Current Solution)
=LEFT(C2,35) as suggested by Paul below!



Answer



This question was answered in the comments and was collaborative, but here is my answer combined with Tony's:


=TRIM(LEFT(C2,35))

No comments:

Post a Comment

Where does Skype save my contact's avatars in Linux?

I'm using Skype on Linux. Where can I find images cached by skype of my contact's avatars? Answer I wanted to get those Skype avat...