Read an ID at the end of a web address
Turn a link ending in /000123?view=full into 000123, zeros kept.
Download Excel templateMicrosoft 365
What you'll make

The formula

| Number | Part | What it does | Result so far |
|---|---|---|---|
| 1 | A8 | The web address. | "…/000123?view=full" |
| 2 | TEXTAFTER( … ,"/",-1) | Keeps the text after the last slash. | "000123?view=full" |
| 3 | &"?" | Adds a ? at the end, so there is always one. | "000123?view=full?" |
| 4 | TEXTBEFORE( … ,"?") | Keeps the text before the first ?. | "000123" |
Each bracket wraps the one before it, so Excel works from the inside out. The -1 means the last slash.
=TEXTBEFORE(TEXTAFTER(A8,"/",-1)&"?","?")How to use it
Yellow bar at the top? Click Enable Editing.
- See it work. The Example tab shows 20 made-up examples with the formula already in.
- Use your own links. Paste web addresses into the green column of the Template tab. The IDs fill in by themselves.
- Move them into your letter. Copy the results. Then use Paste Special and choose Values.
Before you send
Use this only for links that end in the ID. A slash at the end or a # part gives the wrong ID.
Microsoft's help: TEXTAFTER function
OTHER ROUTES YOU MIGHT LIKE

Read an ID by name from a web address
example.test/p?providerId=000123&view=full + providerId → 000123
Get the template →
Read a provider ID from a data snippet
{"providerId":"000123"} → 000123
Get the template →
Group a 16-character ID in blocks of four
1234567890123456 → 1234 5678 9012 3456
Get the template →
Merge a few test letters before the whole mailing
Whole mailing → records 2 to 4 only
Take this route →