-1

I have a big Excel file with a lot of series and episodes, like this

excel

I need to get every episode value (e.g. e01, E02 etc.) and place it in the right column or leave it in the current one.

Some of like don't have episodes, so it must be omited.

What a formula/script do I need to do it?

JvdV
  • 70,606
  • 8
  • 39
  • 70
Qwerty
  • 19
  • 4
  • Post data with image so that we can copy paste to our excel to analyze. Also post what you have tried yet. – Harun24hr Feb 11 '21 at 05:48

1 Answers1

2

You can try FILTERXML() function in this way.

=IFERROR(FILTERXML("<t><s>"&SUBSTITUTE(A1,".","</s><s>")&"</s></t>","//s[starts-with(., 's0')]"),"")

enter image description here

  • Here "<t><s>"&SUBSTITUTE(A1,".","</s><s>")&"</s></t>" will create a valid XML format string.

  • It seems your episode number alwas starts with s0. So, XPATH parameter //s[starts-with(., 's0')] will return that node starts with s0.

  • IFERROR() will return a zero length string if no episode is in your string.

  • If you want only episode numbers like e04, e01 and so on then use below formula.

    =IFERROR(MID(FILTERXML("<t><s>"&SUBSTITUTE(A1,".","</s><s>")&"</s></t>","//s[starts-with(., 's0')]"),4,100),"")

More details about FILTERXML() is in here from JvdV. Excel - Extract substring(s) from string using FILTERXML

Harun24hr
  • 30,391
  • 4
  • 21
  • 36