D
D
Danil2021-05-20 18:29:24
excel
Danil, 2021-05-20 18:29:24

How to remove duplicates from a string?

How to remove duplicates from a string using formulas?

INCLUDED: -Tulle airy blouson with knitted trim. Composition of blouson : 100% polyester - T-shirt two-tone Composition of blouson : 92% cotton, 8% polyester 30°C. 2) Do not bleach. 3) Iron at a temperature not exceeding 150°C. 4) Dry the product in a suspended state. * Commodity Blouson, T-shirt *Recommendations For the durability of the product, use our recommendations. The product will last a long time if you adhere to the following recommendations: 1) Wash at a temperature not exceeding 30°C. 2) Do not bleach. 3) Iron at a temperature not exceeding 150°C. 4) Dry the product in a suspended state.

As you can see the text is duplicated several times in a line, how can I remove the duplicate line by line?
Or maybe remove duplicate words line by line?

Answer the question

In order to leave comments, you need to log in

1 answer(s)
A
Alexander Ivanov, 2021-05-21
@oshliaer

As for Google Sheets, this is not possible due to the peculiarities of the regular expression language.
Solved by custom formula

function REMOVESUBSTRDUPLICATES(string) {
  var patt = /(.+)\1+/g;
  var res = string;
  var acc;
  while (acc !== res) {
    acc = res;
    res = res.replace(/(.+)\1+/g, '$1');
  }
  return res;
}

60a773c123432625792120.png
Regular expressions in Google Sheets. Syntax...

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question