How to Extract a Variable Site Name from a URL in Excel
Question details
The user needs to isolate and extract a variable-length SharePoint site name from a list of URLs using an Excel formula.

- Product
- Excel
- Device & OS
- not provided
- Scenario
- Working with a list of SharePoint URLs where the site name segment varies in character length (e.g., example6 vs example666) and needs to be cleanly extracted into a separate column.
- Observed behavior
- The user requires a dynamic formula that accurately locates and extracts just the site name portion of the URL regardless of its length, moving away from fixed-length text extraction approaches.
Ensure your list of URLs follows a relatively consistent domain structure (e.g., the site name always appears between '.com/' and the next '/') so that your extraction formulas can accurately target the boundary characters.
Use MID and FIND Functions for Dynamic Boundaries
This method locates the exact starting and ending points of the variable segment, making it perfect for extracting text of any length located between specific URL markers.
By combining the MID function with the FIND function, Excel can dynamically calculate where the site name begins and ends based on the placement of slashes, completely eliminating the need for fixed character counts.
Click on the empty cell in the column where you want the extracted site name to appear, typically right next to your URL data.
Type the following formula: =MID(A1,FIND(".com/",A1)+5,FIND("/",A1,FIND(".com/",A1)+6)-FIND(".com/",A1)-6) (assuming your URL is in cell A1).
Press Enter to extract the site name, then click and drag the fill handle (the small square at the bottom-right of the cell) down to apply the formula to the remaining URLs.

Use TEXTSPLIT and CHOOSECOLS (Microsoft 365)
A simpler, modern array formula approach that splits the entire URL by its slashes and allows you to select the specific column containing the site name.
Use SUBSTITUTE for Consistent Suffixes
If the URL has a fixed starting structure and a known fixed ending string, you can substitute the ending out and use a simpler MID extraction.
Extract Text from URLs Easily with WPS Spreadsheet
WPS Office Spreadsheet fully supports advanced text functions like MID, FIND, and array formulas. You can seamlessly manipulate URL data, extract specific strings, and utilize Flash Fill for quick pattern recognition without writing complex code.
- 1. Open your file in WPS: Launch WPS Spreadsheet and open the document containing your list of URLs.
- 2. Apply a text formula: Use the MID and FIND formulas exactly as you would in Excel to dynamically extract the variable site names.
- 3. Use Flash Fill for instant results: Alternatively, type the desired site name manually in the first row, select the cell below it, and press Ctrl+E. WPS will automatically detect the pattern and fill the remaining cells.

Frequently Asked Questions
Why does my FIND formula return a #VALUE! error?
This error occurs if the specific text you are searching for (like '.com/') cannot be found within the referenced cell. Double-check your URL string to ensure it contains the exact characters specified in your FIND function.
Can I extract the site name using the Data tab instead of formulas?
Yes. You can use the 'Flash Fill' feature by typing the site name in the first row and pressing Ctrl+E. Alternatively, you can use the 'Text to Columns' feature under the Data tab, select 'Delimited', and set the forward slash (/) as your delimiter to split the URL into separate columns.
Is TEXTSPLIT available in older versions of Excel?
No, the TEXTSPLIT function is only available in Microsoft 365 and Excel for the web. If you are using an older desktop version like Excel 2019 or 2016, you should rely on the MID and FIND combination or use the Flash Fill feature.




