We're aware that some users are experiencing technical issues which the team are working to resolve. See the Community Noticeboard for more info. Thank you for your patience.
📨 Have you signed up to the Forum's new Email Digest yet? Get a selection of trending threads sent straight to your inbox daily, weekly or monthly!

Excel String Handling

Options
Hi. I am looking for help with the following as I have been going around in circles. In column A I might have something like the following:
Astrazeneca (AZN)
Mustang Energy (MUST)
In column B, I would like to see just the stock ticker of AZN or MUST, respectively.
I have been trying mid, left, right, find, if.
How would you extract the stock ticker from the above strings?
Many thanks in advance.

Comments

  • KingL2
    KingL2 Posts: 88 Forumite
    Fifth Anniversary 10 Posts
    =FIND("(",A1) will find the position of the first (
    add one to that to find the first letter of the tracker string, (call that y, for now)
    assuming that the string is always the first three letters, then =(Mid(a1,y,3) returns the string
    to combine all that in one formula
    =MID(A1,((FIND("(",A1))+1),3)


  • KingL2
    KingL2 Posts: 88 Forumite
    Fifth Anniversary 10 Posts
    sorry, just re read it
    if the string in the brackets isn't always three characters
    use =find again to find the location of the )
    subtract the position of the ( from the position of the )  to get the length of what's inside the brackets (actually, subtract another 1 from it)
    then you're replacing the final 3 in the =MID statement in the post above with the actual length of the string.
    or all combined:
    =MID(A1,((FIND("(",A1))+1),(((FIND(")",A1))-(FIND("(",A1))))-1)



  • lr1277
    lr1277 Posts: 2,131 Forumite
    Part of the Furniture 1,000 Posts Name Dropper Combo Breaker
    KingL2 said:
    sorry, just re read it
    if the string in the brackets isn't always three characters
    use =find again to find the location of the )
    subtract the position of the ( from the position of the )  to get the length of what's inside the brackets (actually, subtract another 1 from it)
    then you're replacing the final 3 in the =MID statement in the post above with the actual length of the string.
    or all combined:
    =MID(A1,((FIND("(",A1))+1),(((FIND(")",A1))-(FIND("(",A1))))-1)



    Thank you so much. That worked a treat. I started but then got confused on finding whether the stock code was 3 or 4 characters.

  • KingL2
    KingL2 Posts: 88 Forumite
    Fifth Anniversary 10 Posts
    yeah, if it's not clear from the above, the
    Length is [position of closing bracket]-[position of opening bracket]-1
    HTH
  • lr1277
    lr1277 Posts: 2,131 Forumite
    Part of the Furniture 1,000 Posts Name Dropper Combo Breaker
    Ahh, thank you. I understand.
Meet your Ambassadors

🚀 Getting Started

Hi new member!

Our Getting Started Guide will help you get the most out of the Forum

Categories

  • All Categories
  • 350.8K Banking & Borrowing
  • 253.1K Reduce Debt & Boost Income
  • 453.5K Spending & Discounts
  • 243.8K Work, Benefits & Business
  • 598.7K Mortgages, Homes & Bills
  • 176.8K Life & Family
  • 257.1K Travel & Transport
  • 1.5M Hobbies & Leisure
  • 16.1K Discuss & Feedback
  • 37.6K Read-Only Boards

Is this how you want to be seen?

We see you are using a default avatar. It takes only a few seconds to pick a picture.