Excel formula or otherwise VBA: = right (find last |) give result

Leske

Active Member
Joined
Aug 26, 2008
Messages
297
Hello,


I have several cells in a column where there could be 1, 2 or 3 "|" in the cell:

1093270| 29.03.2012|Mail opvragen Doc's


I just want him to look at the last "|" and give me everything that comes after the last |


i have at the moment this: (added 3 columns)

=MID(A1;FIND("|";A1)+1;150)
</SPAN>
=IFERROR(MID(B1;FIND("|";B1)+1;150);B1)</SPAN>
=IFERROR(MID(C1;FIND("|";C1)+1;150);C1)</SPAN>

<TBODY>
</TBODY>


(result is: Mail opvragen Doc's)

it does the trick, but i prefer one formula so i don't have to add them.
Does anyone know a better way then this?

Kind regards,

Les
 

Excel Facts

Excel motto
Not everything I do at work revolves around Excel. Only the fun parts.
Try:

=MID(SUBSTITUTE(A1,"|","@",LEN(A1)-LEN(SUBSTITUTE(A1,"|","" ))),FIND("@",SUBSTITUTE(A1,"|","@",LEN(A1)-LEN(SUBSTITUTE(A1,"|",""))))+1,255)
 
Upvote 0
i got #value, could it be that it has to do with "@" that he doesn't recognize it?

i changed the , to ;
 
Upvote 0
yes fine thx it works

but how does it work?

because rept i don't know and why do you use " ";99

Many kind regards,

Lesly
 
Upvote 0
The REPT function repeats the text in its first argument (in this case a space) the number of times in its second argument. The 99 is just a large number. So SUBSTITUTE replaces each | in the text with 99 spaces. Then the RIGHT function extracts the rightmost 99 characters in the amended text, including some of the 99 spaces where the last | was. Finally, TRIM removes the unwanted leading spaces.
 
Upvote 0
yes i found out how it worked just know.

It is easy but we always try to make it to complex to finding a sollution.

Thx very mush

also thx for the explenation
 
Upvote 0

Forum statistics

Threads
1,214,621
Messages
6,120,563
Members
448,972
Latest member
Shantanu2024

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