Search code examples
regexgoogle-sheetsgoogle-sheets-formulaspreadsheet

Extract Keywords with the # in front of the characters


i would like your help to share your insights on this. What i try to achieve here is to extract the whatever hashtag with the keywords in the sentence. I try to use regextract formula but seems like my intelligence is severely limited

Retreive the Four # with keywords in the following sentence which the keywords will always come with the # at the initial and following by comma ",", but the last one keywords will goes without comma ",":

sentence sentence sentence sentence sentence sentence sentence #Blue,#Black,#Yellow,#Green John:sample sample sample // sample sample sample Alia: sample sample sample // sample sample sample

End Results:

#Blue,#Black,#Yellow,#Green

Here is the trix if you would like to work on the file directly here


Data Results that i want to achieve
sample:sample sample sample // sample sample sample #Blue,#Black,#Yellow,#Black John:sample sample sample // sample sample sample Alia: sample sample sample // sample sample sample #Blue,#Black,#Yellow,#Black
sample:sample sample sample // sample sample sample #Blue,#Yellow John:sample sample sample // sample sample sample Alia: sample sample sample // sample sample sample #Blue,#Yellow

Solution

  • Use this

    =ArrayFormula(IFERROR(REGEXEXTRACT(A2:A, "#.+"),""))
    

    enter image description here