o1-preview-2024-09-12· openai
from WildChat-4.8M
hi, i need a formula for excel what can select part of string on cell, need to select…
- User
hi, i need a formula for excel what can select part of string on cell, need to select from 3th "." to 7 after taht
- Assistant
To extract a substring from a cell starting after the 3rd occurrence of a period '.' and including the next 7 characters, you can use the following formula:
excel=MID(A1, FIND(CHAR(1), SUBSTITUTE(A1, ".", CHAR(1), 3)) + 1, 7)Explanation:
SUBSTITUTE(A1, ".", CHAR(1), 3): This part replaces the 3rd occurrence of '.' with a unique character (here,CHAR(1)), which doesn't appear in your text.FIND(CHAR(1), ...): This finds the position of that unique character, effectively locating the position of the 3rd '.'.+ 1: Adjusts the position to start after the 3rd '.'.MID(A1, ..., 7): Extracts 7 characters starting from the calculated position.
Usage:
- Replace
A1with the reference to the cell containing your text. - If your delimiter is different from '.', replace the '.' in the
SUBSTITUTEfunction with your actual delimiter. - Adjust the
7at the end of the formula if you need a different number of characters.
Example:
If cell A1 contains the text
abc.def.ghi.jkl.mno.pqr, the formula will returnjkl.mno, which is the 7 characters starting after the 3rd '.'.
Note: This formula assumes that there are at least 3 periods in your text and that you want exactly 7 characters after the third period. If your data might not meet these conditions, you may need to add error handling to the formula to manage such cases.
Final Formula:
excel=MID(A1, FIND(CHAR(1), SUBSTITUTE(A1, ".", CHAR(1), 3)) + 1, 7)