Extract two words from a cell in to another cell i

2019-01-29 11:53发布

问题:

I am new to google spreadsheets & want to copy class names mentioned in range c10 in to b3. I am trying to use following formula which I know is wrong:

=query(C3:C52, "copy class name where C contains 'class' in cell c10 ")

C10 cell contains following data:

<body bgcolor="beige" class="body"> <div class="big_wrapper">

I want following two words to appear in cell b3:

body big_wrapper

Please correct above formula.

For more clarity visit sheet1 of following link:

https://docs.google.com/spreadsheets/d/1HfgOqprc-P34vOI-nGAionllrGAOsMOVuLB5ozboWBY/edit#gid=0

回答1:

There may be easier ways, but try (in B3):

=join(" ", regexextract(C10, "class="&char(34)&"(.+?)"&char(34)&">.+class="&char(34)&"(.+?)"&char(34)&">"))