Reputation: 31
I would like to take a URL and extract characters to multiple cells in Google Sheets.
The format of these URLs are:
https://www.sideshow.com/collectibles/{PRODUCT_NAME}-{PRODUCT_ID}
This is an example of the URL:
I'd like to extract the following to 2 different cells:
The Product Name, marvel-scarlet-witch
, will change with every URL but its position in the URL is constant.
I'm not sure if all this can be done in a single action or if two separate ones would be required.
Upvotes: 3
Views: 69
Reputation: 1273
Assuming that the string is in cell C1
.
To extract Product ID from the given URL format, use the formula on A1
cell:
=PROPER(SUBSTITUTE(REGEXEXTRACT(C1,".*/(.*)-sideshow-collectibles"), "-", " "))
To extract Product Name from the given URL format, use the formula on B1
cell:
=RIGHT(C1,6)
Upvotes: 0