0

I'm having some difficulty to extract the information inside the string.

For example, I would like to have the entire line where I have "MODERATE: harm/physical violence/physical abuse [220]", actually the line where I have the code [220].

An example, I have this text on the column BS

"NONE: sexual/anatomy/nudity [152],
NONE: sexual/sex acts [100],
NONE: language/profanity [400],
NONE: harm/physical violence/moment of death [227],
MODERATE: harm/physical violence/physical abuse [220],
NONE: modifier/intent/edsa [902],
NONE: modifier/video games [963],
NONE: modifier/music video [960],
NONE: modifier/news [961]"

and I would like to take out those parts separeted with the following codes (not the entire information):

NONE: sexual/anatomy/nudity [152]

NONE: sexual/sex acts [100]

NONE: language/profanity [400]

MODERATE: harm/physical violence/physical abuse [220]

But I need to be aware cause sometimes the information doesnt come on this way, it may change and also have other information.

Here is a test sheet with some information and the expected result

https://docs.google.com/spreadsheets/d/16fA2e3e6fm-xwkFek28pJ2VHL4F_fiYWvkIVmDuFNEo/edit?usp=sharing

enter image description here

7
  • what do you really want ? can you give an example output ? the text is a bit confusing Commented Oct 20, 2020 at 13:06
  • Sorry, I edited to have an example of the final thing Commented Oct 20, 2020 at 13:13
  • "...sometimes the information doesn't come on this way, it may change and also have other information". This is way too vague. What do you mean? Please do not explain in words. Please read how to and share a test sheet with expected results so as you can be easier helped. Commented Oct 20, 2020 at 13:36
  • Thanks, I'll created and shate the test sheet, thanks for the informaiton Commented Oct 20, 2020 at 13:40
  • Perhaps you are looking for Text to Column behaviour? Splitting that string at each comma. support.google.com/docs/answer/6325535 Commented Oct 20, 2020 at 13:52

1 Answer 1

1

Please see if the following meets your needs

In cell D4 place the following formula

=ArrayFormula(IFERROR(if(LEN(A4:A),IF(--REGEXEXTRACT(A4:A, ""&D2&"")=D2,REGEXEXTRACT(A4:A, ".*\["&D2&"\]")),"")))

Then adjust for the rest cells E4, F4, etc accordingly

Sign up to request clarification or add additional context in comments.

1 Comment

is exactly what I would like to use, thank you so much for your time and effort

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.