Link to home
Start Free TrialLog in
Avatar of Alex Campbell
Alex CampbellFlag for United States of America

asked on

Would like this function to be made to work like a MID function, but in reverse.

I have a number of cells like this:
a2= Text to Columns - Data > Data Tools > Text to Columns
The number of dashes vary before the > symbol, but I always want to pull the data from the end of the cell up to the dash.

The function would work like this: FromEnd("-",a2) and it would return
- Data > Data Tools > Text to Columns

I could then use Mid to select after the dash.

Function Reverse(str As String) As String
    Reverse = StrReverse(Trim(str))
End Function
ASKER CERTIFIED SOLUTION
Avatar of Martin Liss
Martin Liss
Flag of United States of America image

Link to home
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Start Free Trial
You may use inbuilt functions to get the desired output.
Please try this....
=TRIM(RIGHT(SUBSTITUTE(A2,"-",REPT(" ",LEN(A2))),LEN(A2)))

Open in new window

Avatar of Alex Campbell

ASKER

Thanks, works great.
You're welcome and I'm glad I was able to help.

If you expand the “Full Biography” section of my profile you'll find links to some articles I've written that may interest you.

Marty - Microsoft MVP 2009 to 2016
              Experts Exchange MVE 2015
              Experts Exchange Top Expert Visual Basic Classic 2012 to 2015