How to Remove Protocol From Url in Excel
Learn multiple Excel methods to remove protocol from url with step-by-step examples and practical applications.
How to Remove Protocol From Url in Excel
Why This Task Matters in Excel
Every day, analysts, marketers, and IT professionals exchange spreadsheets packed with website addresses. In most cases the receiving system, report, or dashboard only needs the “domain + path.” The protocol—such as http://, https://, ftp://, or file://—is redundant, and sometimes it even breaks downstream logic. For instance, campaign-tracking tools often concatenate “https://” automatically. If your exported data already contains the protocol, you end up with malformed URLs like https://https://company.com/landing.
Removing the protocol is also crucial for data comparison. Imagine a cybersecurity analyst cross-checking a list of suspicious domains against an internal whitelist. If one list contains https://example.net and the other contains example.net, a direct lookup fails—forcing manual cleanup. In e-commerce, the warehouse team could run into mismatched URLs when printing QR codes that must exclude protocols to stay under character limits.
Excel shines at quick data transformations, especially when the dataset is not large enough to justify a database or ETL pipeline. You can apply a single formula down thousands of rows, use Flash Fill to recognize patterns, or push the data into Power Query for a no-code solution. Every method is fast, repeatable, and auditable. Failing to strip protocols can lead to inflated file sizes, duplicate records, broken hyperlinks, or incorrect analytics attribution—all of which translate to wasted time and money. Mastering the removal of protocols therefore links directly to better data hygiene, reliable reporting, and smoother integration with other Excel-centric workflows such as VLOOKUP‐based matching, PivotTables, and dashboards that rely on clean URL strings.
Best Excel Approach
The most robust, version-agnostic formula uses SUBSTITUTE in combination with IF to handle both http:// and https:// without double-stripping mid-string occurrences. The logic is simple: if the text begins with a known protocol, replace it with an empty string; otherwise return the original URL.
Syntax for a single-protocol variant:
=SUBSTITUTE(A2,"http://","")
Comprehensive two-protocol solution:
=IF(LEFT(A2,8)="https://",
SUBSTITUTE(A2,"https://",""),
IF(LEFT(A2,7)="http://",
SUBSTITUTE(A2,"http://",""),
A2))
In Microsoft 365 or Excel 2021, the new TEXTAFTER function reduces complexity:
=TEXTAFTER(A2,"://")
TEXTAFTER locates the first occurrence of \"://\" and returns everything to the right. This works regardless of the protocol’s length (ftp://, sftp://, etc.). Use ,1-based optional parameters to control which delimiter instance to target if “://” appears later in the string, though that is rare in URL stems.
Choose SUBSTITUTE when you must support Excel 2016 or earlier. Opt for TEXTAFTER when everyone in your organization runs the Microsoft 365 subscription because it is cleaner, faster, and automatically ignores case.
Parameters and Inputs
- Source cell – typically text in [A2] or any column. It must be recognized as plain text; numeric or error values will propagate errors.
- Protocol delimiter –
"http://"or"https://"in theSUBSTITUTEversion, or"://"inTEXTAFTER. This is case-sensitive in older Excel versions; ensure lowercase to match standard URLs. - Occurrence number (optional in
TEXTAFTER) – defaults to first instance. Set to2if your string might contain an embedded credential such ashttps://user:pass@example.com. - Default return – with
IFERROR, you can specify what happens when the delimiter is missing:
=IFERROR(TEXTAFTER(A2,"://"),A2)
Data preparation tips:
- Trim leading/trailing spaces with
TRIMif URLs come from copy-paste. - Use
CLEANto remove non-printing characters from scraped lists. - Validate with
ISTEXTto catch accidental numeric IDs or nulls.
Edge cases include protocol-less URLs already in the desired shape (our formulas return them untouched) and malformed strings likehttps:///example.comwhich may leave an empty leading slash.
Step-by-Step Examples
Example 1: Basic Scenario
Imagine a marketing intern receives a CSV containing 500 landing-page URLs in column A. The analytics platform later appends “https://” automatically, so the intern must strip existing protocols.
- Open the CSV and insert a new heading in [B1]:
URL_No_Protocol. - In [B2] type:
=IF(LEFT(A2,8)="https://",
SUBSTITUTE(A2,"https://",""),
IF(LEFT(A2,7)="http://",
SUBSTITUTE(A2,"http://",""),
A2))
- Press Enter and double-click the fill handle to copy down 500 rows.
- Spot-check: the original
https://company.com/homebecomescompany.com/home; the plain stringnews.company.com/aboutremains unchanged. - Copy [B] and use Paste Special → Values to freeze the result, then delete column A if needed.
Why it works:
LEFTquickly confirms whether the protocol sits at the beginning, avoiding accidental substitution of “http://” deeper in a query string.SUBSTITUTEreplaces only that first match because URLs rarely contain “http://” twice.
Troubleshooting: if you see#VALUE!, the cell might contain more than 32,767 characters or be non-text; wrap withIFERRORor convert numbers to text viaTEXTor'.
Example 2: Real-World Application
A compliance officer audits supplier portals. The master inventory lists domains only, while exported logs from a firewall monitoring tool list full URLs. To perform a VLOOKUP, you need to homogenize both lists.
Data setup:
- Sheet Import column A: full URLs like
https://portal.vendor-a.org/login.aspx?usr=joe. - Sheet Master column A: vendor domains like
portal.vendor-a.org.
Steps:
- In Sheet Import, create column B header
NormalizedDomain. - Enter the modern formula in [B2]:
=TEXTAFTER(A2,"://")
- Copy the formula down 20,000 rows; Excel’s Spill engine auto-renders instantly on Microsoft 365.
- To isolate only the host without the path, nest
TEXTBEFORE:
=TEXTBEFORE(TEXTAFTER(A2,"://"),"/")
- Flip over to Sheet Master. In column B add:
=IFNA(VLOOKUP(A2,Import!B:B,1,FALSE),"Not found")
- Filter results to identify missing suppliers.
Business impact: the audit, previously involving manual copy-paste and 4 hours of work, now completes in under 5 minutes. Integration: the extracted host works seamlessly with PivotTables for frequency counts and with Conditional Formatting to flag high-risk domains. Performance: TEXTAFTER plus TEXTBEFORE processes 20,000 rows in milliseconds because both functions are optimized native C++ routines and avoid volatile dependencies.
Example 3: Advanced Technique
Some SaaS platforms embed credentials in URLs: https://user:pass@secure.example.com:8080/dashboard. You need to strip both the protocol and the credentials while preserving the host and optional port.
Formula (365 only):
=LET(
raw, A2,
noProto, TEXTAFTER(raw,"://"),
noCreds, IF(ISNUMBER(SEARCH("@",noProto)),
TEXTAFTER(noProto,"@"),
noProto),
noCreds
)
Explanation:
LETstores intermediate values without recalculating.SEARCHchecks for “@” which splits credentials from the host.- If “@” exists,
TEXTAFTERgrabs everything to the right; otherwise, keep the original.
Edge cases: for bare domains with no credentials, the formula returns instantly with minimal overhead. For complex URLs, the process is O(1) because each text function scans the string once.
Professional tips:
- Wrap the final result in
LOWERto standardize case before joining with other case-sensitive systems. - Append
":"&TEXTAFTER(noCreds,":",2)insideLETif you must keep custom ports. - Use
FILTERto flag records whereSEARCH("@",noProto)returns a number, which may violate security policy.
Tips and Best Practices
- Keep a dedicated “working” column so the original URL remains intact for auditing.
- Combine
TRIMandCLEANwith your main formula for bullet-proof ingestion from emails or PDFs. - Store formula snippets in Excel’s AutoCorrect or a personal macro workbook to reuse quickly.
- Use dynamic array formulas (
TEXTAFTER,TEXTBEFORE) when targeting Microsoft 365; they calculate faster and spill automatically. - After transformation, convert formulas to values before sharing workbooks externally to prevent accidental recalculation errors.
- For large datasets, perform the operation in Power Query then load as a connection—this keeps the main worksheet light and refreshable.
Common Mistakes to Avoid
- Substituting “http://” without checking position can corrupt query strings that legitimately include “http://” later. Fix: wrap in
LEFTorTEXTBEFORE. - Forgetting to add the trailing slashes in the
SUBSTITUTEtarget leads to partial words removed (e.g., “http” insidehttpStatus). Fix: always use"://"delimiter. - Using case-sensitive search in inconsistently cased data. Fix: wrap source in
LOWERand lower-case the delimiter. - Overwriting original data without backup. Fix: create a duplicate column or save a versioned copy.
- Applying formulas to entire columns in pre-2007 workbooks with 65,536 rows, causing “Calculation chain exceeded” sluggishness. Fix: convert the range to an Excel Table so formulas apply only to populated rows.
Alternative Methods
| Method | Pros | Cons | Best For |
|---|---|---|---|
TEXTAFTER | Short, automatic spill, supports any protocol length | Microsoft 365 only | Modern environments |
SUBSTITUTE + IF | Compatible back to Excel 2007, straightforward | Needs separate checks for http and https | Mixed-version teams |
FIND + MID | Fine-grained control over position | More complex, easy to mis-offset | Educational demos |
| Flash Fill | No formulas, intuitive | Manual trigger, brittle under change | One-off cleanups |
| Power Query | GUI driven, refreshable, huge datasets | Initial setup time | Scheduled imports or millions of rows |
When choosing, weigh compatibility versus elegance. Upgrade paths: once the team migrates to Microsoft 365, convert SUBSTITUTE logic to TEXTAFTER for readability. For recurrent tasks, a Power Query transformation with a “Replace Values” step is future-proof.
FAQ
When should I use this approach?
Use formula-based stripping for quick, ad-hoc datasets under a few hundred thousand rows, especially when you need immediate calculation on the sheet. Switch to Power Query when the task recurs regularly or data exceeds one million rows.
Can this work across multiple sheets?
Yes. Simply reference the source sheet:
=TEXTAFTER(Sheet1!A2,"://")
Dynamic array formulas will still spill within the target sheet.
What are the limitations?
TEXTAFTER cannot be nested inside older Excel; it requires Microsoft 365 or Excel 2021. SUBSTITUTE is case-sensitive, and both methods assume the delimiter exists only once near the start. Malformed URLs with spaces may yield unexpected output.
How do I handle errors?
Wrap the formula with IFERROR to return the original URL or a blank string. In Power Query, use the “Replace Errors” step to set a default value.
Does this work in older Excel versions?
SUBSTITUTE + IF works back to Excel 2007. For Excel 2003, use MID(A2,FIND("://",A2)+3,255). Flash Fill is unavailable before 2013.
What about performance with large datasets?
On modern processors, TEXTAFTER processes around 1.5 million rows in under five seconds. With SUBSTITUTE, expect similar speed but ensure calculation mode is set to Manual when pasting gigantic lists to prevent UI freezes.
Conclusion
Cleaning URLs by removing their protocols is a deceptively simple task with outsized benefits: reduced data redundancy, successful lookups, and fewer integration headaches. Whether you rely on the elegant TEXTAFTER function, backward-compatible SUBSTITUTE, or a GUI-driven Power Query step, Excel offers a solution that matches every skill level and environment. Master this technique today and you’ll streamline web analytics, compliance audits, and countless other workflows—cementing your status as the spreadsheet troubleshooter everyone relies on.
Related Articles
How to Show the 10 Most Common Text Values in Excel
Learn multiple Excel methods to list the 10 most frequent text values—complete with step-by-step examples, business use cases, and expert tips.
How to Abbreviate Names Or Words in Excel
Learn multiple Excel methods to abbreviate names or words with step-by-step examples and practical applications.
How to Abbreviate State Names in Excel
Learn multiple Excel methods to abbreviate state names with step-by-step examples, professional tips, and real-world applications.