W
W
WebAnalytics12017-11-10 11:58:41
Spreadsheets
WebAnalytics1, 2017-11-10 11:58:41

Google Sheets or Excel: How to write a formula\script for splitting by columns and clearing by regular expressions in one step?

Hello,
Please help me to write a script\formula.
Need this text
http://www.site.ru/bonus/?utm_medium=cpc&utm_sourc...
1. Divide by columns by separator "||"
2. Remove all UTM tags (Everything that comes after utm, including utm itself)
3. Collect everything in one column
That is, at the end of this cell should be
www.site.ru/bonus
www.site.ru/santehnika/smesiteli/ dlja-kuhni
www.site.ru/dostavka/SPB
www.site.ru/akcii
Separately, each step turned out in Google Sheets
1.=SPLIT(A1;"||";FALSE)
2.=REGEXREPLACE(A2;"( \?|\&)(utm|rc|catid).*";"")
but since there are so many links, it takes a lot of time. Is there any way to optimize this process?
The result was this https://docs.google.com/spreadsheets/d/1ywkbEF5HFr...
On the last page in Cell A, 5 filled lines, but they are separated by empty cells

Answer the question

In order to leave comments, you need to log in

1 answer(s)
A
Anton Kiselyov, 2017-11-14
@zamboga

Everything is very simple.

  • Paste everything into Excel
  • CTRL+H --> replace "http://" with "|http://" -- this will set the ground for future separation. https://i.imgur.com/ep0uX1h.png
  • separate text by columns https://i.imgur.com/1qr1Lue.png
  • CTRL+H -> replace "?utm*" with "" (blank) https://i.imgur.com/PFMX3vQ.png
  • copy line, paste as column https://i.imgur.com/eScwDgf.png
  • profit https://i.imgur.com/bhylJda.png
  • after the tests, write a macro in Excel if the task is repetitive

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question