Google-sheets – Generating Google Spreadsheet Links from cell contents

google sheets

You previously answered a part of my question, but I am looking to modify this behavior in multiple rows of column A so I don't want to manually correct it.

In A2 I have:

/mylist/groceries/index.html

In B2 I use concatenate

=HYPERLINK(CONCATENATE("https//mylife.com",A2),A2)

This creates the link I need, and returns the same text that is in A2, but I want just the first portion without the/index.html to be viewable.

/mylist/groceries

I do not want the "/index.html" to show

Best Answer

Clear Column B entirely, then place the following array formula into cell B2:

=ArrayFormula(IF(A2:A="",,HYPERLINK("https//mylife.com"&A2:A,REGEXREPLACE(A2:A,"/index.html",""))))

This should process everything in Column A as you would like.