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

Test for Multiple Conditions in IF?
Use AND(test, test, test, test) or OR(test, test, test, ...) as the logical_test argument of IF.
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,216,113
Messages
6,128,904
Members
449,477
Latest member
panjongshing

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