Extract Invoice number, Mid, Right, Left, Replace, 10^10 etc.

srizki

Well-known Member
Joined
Jan 14, 2003
Messages
1,860
Office Version
  1. 365
Platform
  1. Windows
I have string,
S:\Houston JIB Accounting\Outside Operated JIB's\Jacquie's Group JIBs\SOHAIL RIZKI UPLOADS\Cocohills\241005-PHOO2\0817NNJ036241005-SBOO2.xlsm
And I need to extract 0817NNJ036241005-SBOO2 here it happens to be the last in this string, I would like to know how to extract this and also, if it is not the last part of the string how will I extract then.

Regards,
 

Excel Facts

Difference between two dates
Secret function! Use =DATEDIF(A2,B2,"Y")&" years"&=DATEDIF(A2,B2,"YM")&" months"&=DATEDIF(A2,B2,"MD")&" days"
Thank you Joe4

It is working as I wanted.
Here is another formula that you can consider (little bit shorter, 2 less function calls)...

=TRIM(LEFT(RIGHT(SUBSTITUTE(SUBSTITUTE(A1,".",""),"",REPT(" ",300)),600),300))
 
Upvote 0
Thank you Rick,
I really appreciate it.
Just wondering how does it work, is there a book or website where I can learn the advance formula?

But this is the result of the formula,
S:\Houston JIB Accounting\Outside Operated JIB's\Jacquie's Group JIBs\SOHAIL RIZKI UPLOADS\ConocoPhillips\241005-PHOO2\1117NNJ036241005-SBOO2xlsm
It removed the ".", and did not extract the last part, 1117NNJ036241005-SBOO2


Best regards,
 
Last edited:
Upvote 0
But this is the result of the formula,
S:\Houston JIB Accounting\Outside Operated JIB's\Jacquie's Group JIBs\SOHAIL RIZKI UPLOADS\ConocoPhillips\241005-PHOO2\1117NNJ036241005-SBOO2xlsm
It removed the ".", and did not extract the last part, 1117NNJ036241005-SBOO2
It looks like my originally posted formula had the backslashed removed (two of them) by this forum's comment processor. I am going to try an post it again, with all the text, in a Code Box and see if the backslashes are preserved there...
Code:
=TRIM(LEFT(RIGHT(SUBSTITUTE(SUBSTITUTE(A1,".","[B][COLOR="#FF0000"]\[/COLOR][/B]"),"[B][COLOR="#FF0000"]\[/COLOR][/B]",REPT(" ",300)),600),300))

Edit Note: I just looked and the backslashes (highlighted in red) are preserved, so use what is shown in the Code Box above instead of what got posted in my earlier message.
 
Last edited:
Upvote 0

Forum statistics

Threads
1,223,911
Messages
6,175,324
Members
452,635
Latest member
laura12345

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