Joined
Jan 16, 2014
Messages
2
I want to do this with only formula, not any scripts.

I want to be able to Remove everything BEFORE the LAST occurrence of the a period (and keep the cell blank if there isn't a period present).

Ex:
This table shows what I need it to do.My current formula handles rows 2-4. However, I need help with row 5.
A
BNote
2helloworld.pdfpdfremoved everything before last period
3hi.hop.docdocnotice this has two periods. it needs to remove everything BEFORE the last period
4happytimes\document.txttxtremoved everything before last period
5document1Since a period is not present. I need it to be blank.

<tbody>
</tbody>
The formula below works great at removing everything after last occurrence of the period. However, it returns the cell value if a period isn't present in column A (as shown below).
=TRIM(LEFT(RIGHT(SUBSTITUTE(A2,".",REPT(" ",LEN(A2))),LEN(A2)),LEN(A2)))

Ex:
5document1document1Since a period is not present. I need it to be blank. The formula is currently returning the value in column A when a period isn't present.

<tbody>
</tbody>
 
Last edited:

Excel Facts

How to fill five years of quarters?
Type 1Q-2023 in a cell. Grab the fill handle and drag down or right. After 4Q-2023, Excel will jump to 1Q-2024. Dash can be any character.
Try

=IF(ISNUMBER(SEARCH(".",A2)),TRIM(LEFT(RIGHT(SUBSTITUTE(A2,".",REPT(" ",LEN(A2))),LEN(A2)),LEN(A2))),"")

M.
 
Upvote 0
Perhaps

=TRIM(SUBSTITUTE(RIGHT(SUBSTITUTE(A2,".",REPT(" ",LEN(A2))),LEN(A2)),A2,""))
 
Last edited:
Upvote 0
I see you have already been provided with an answer, but here is another one which may work:

=IF(ISERR(FIND(".",A1,1)),"",RIGHT(A1,LEN(A1)-FIND(".",A1,1)))
 
Upvote 0
Just for the hell of it i had another go and came up with this which seems to work with double '.':

=IF(ISERR(FIND(".",A1,1)),"",RIGHT(A1,LEN(A1)-FIND("*",SUBSTITUTE(A1,".","*",LEN(A1)-LEN(SUBSTITUTE(A1,".",""))))))

AP
 
Upvote 0

Forum statistics

Threads
1,215,575
Messages
6,125,619
Members
449,238
Latest member
wcbyers

We've detected that you are using an adblocker.

We have a great community of people providing Excel help here, but the hosting costs are enormous. You can help keep this site running by allowing ads on MrExcel.com.
Allow Ads at MrExcel

Which adblocker are you using?

Disable AdBlock

Follow these easy steps to disable AdBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the icon in the browser’s toolbar.
2)Click on the "Pause on this site" option.
Go back

Disable AdBlock Plus

Follow these easy steps to disable AdBlock Plus

1)Click on the icon in the browser’s toolbar.
2)Click on the toggle to disable it for "mrexcel.com".
Go back

Disable uBlock Origin

Follow these easy steps to disable uBlock Origin

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back

Disable uBlock

Follow these easy steps to disable uBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back
Back
Top