The Problem
You have a list of email addresses in Excel (e.g., john.doe@company.com), and you need to extract just the domain name (company.com). Manually copying and pasting is not an option.
The Easy Way: Use SheetXAI
If you don't want to mess with formulas, the fastest way to do this is simply by asking.
With SheetXAI, you can open the sidebar and type:
Extract the domain from the emails in column A and put them in column B.
SheetXAI will instantly write the formula or script for you and fill the cells. It handles the syntax so you can focus on the result.
The Manual Way: The Formulas You Need
To do this manually, you need to use: LEN, SEARCH, and RIGHT.
1. LEN
Counts the number of characters in a text string.
Syntax: =LEN(text)
- text: The cell containing the text you want to measure.
Example:
If A2 is john@test.com, =LEN(A2) is 13.
2. SEARCH
Finds the position of a specific character.
Syntax: =SEARCH(find_text, within_text)
- find_text: The character you want to find (e.g., "@").
- within_text: The cell containing the text.
Example:
If A2 is john@test.com, =SEARCH("@", A2) is 5.
3. RIGHT
Extracts characters from the end of a string.
Syntax: =RIGHT(text, [num_chars])
- text: The cell containing the text.
- [num_chars]: The number of characters to extract.
Example:
=RIGHT("test.com", 3) is "com".
Understanding the Logic
We calculate the domain length by subtracting the position of the "@" from the total length.
The Final Formula:
=RIGHT(A2, LEN(A2) - SEARCH("@", A2))
Conclusion
Now you know the "classic" way to solve this using formulas. It's a great skill to have.
But for those times when you just want the job done without the mental math, SheetXAI is there to help.