excel - Comparing specific data from string within cells by locating via unique parameters -


i have string looks this:

x-potato-2d-ab3f-n

it in format, , want compare "ab3f"to string of 4 characters. here's catch, values in string may change in length, cannot compare "the first 4 of last 6 characters"

what stay same number of dashes. @ least 4 in total (on rare occasions 5), , string want compare between last two. possible use these isolate 4 or 5 characters want compare?

i know stack overflow doesn't vague questions. sorry! :d

here go:

http://excel.tips.net/t003324_finding_the_nth_occurrence_of_a_character.html

essentially, formula:

=find("¬",substitute(a1,"-","¬",4))

where a1 string. return position of 4th "-". (because substitute replaces 4th "-" "¬", unlikely appear in code, , find finds "¬")

edit, realised 4th group may have more 4 digits, retrieve overcomplicated:

=mid(a1,find("¬",substitute(a1,"-","¬",3))+1,find("¬",substitute(a1,"-","¬",4))-find("¬",substitute(a1,"-","¬",3))-1) 

hope helps!


Comments