+ Reply to Thread
Results 1 to 15 of 15

Add prefix

  1. #1
    Forum Contributor
    Join Date
    10-22-2014
    Location
    Ontario
    MS-Off Ver
    365
    Posts
    222

    Add prefix

    I am trying to automate a list of stock tickers to include the stock exchange prefix. For example General Electric ticker is (GE) and it trades on the New York Stock Exchange (NYSE). If I list GE in one cell I want the next cell to then show NYSE:GE. There are different prefixes for different stock exchanges. I have a legend and a group of stocks showing on the attached sheet with instructions.

    I would appreciate any assistance on this.

    Thanks.

    Peter
    Attached Files Attached Files

  2. #2
    Forum Expert
    Join Date
    03-23-2004
    Location
    London, England
    MS-Off Ver
    Excel 2019
    Posts
    7,064

    Re: Add prefix

    There doesnt seem to be a standard for your table.
    In some cases ticker can be replaced by the Stock Ticker, in other cases -P is removed, but not always.
    There's a lack of consistency.

    This gets you close but doesn't match your output exactly.

    =SUBSTITUTE(SUBSTITUTE(SUBSTITUTE(VLOOKUP(B10,B$3:C$7,2,0),"ticker",C10),".","-"),"-P","")
    Last edited by Special-K; 07-27-2018 at 11:25 AM.
    Regards
    Special-K

    Ensure you describe your problem clearly, I have little time available to solve these problems and do not appreciate numerous changes to them.

  3. #3
    Forum Contributor
    Join Date
    10-22-2014
    Location
    Ontario
    MS-Off Ver
    365
    Posts
    222

    Re: Add prefix

    Yes, I realize I had incorrect information in the legend which I have adjusted. You have done exactly what I was hoping for. There is just one adjustment needed - listed on the sheet.

    Peter
    Attached Files Attached Files

  4. #4
    Valued Forum Contributor mohan.r1980's Avatar
    Join Date
    09-18-2010
    Location
    Mumbai, India
    MS-Off Ver
    Excel 2010 (windows7)
    Posts
    729

    Re: Add prefix

    Hi Peterino

    Try

    Formula: copy to clipboard
    Please Login or Register  to view this content.

  5. #5
    Forum Contributor
    Join Date
    10-22-2014
    Location
    Ontario
    MS-Off Ver
    365
    Posts
    222

    Re: Add prefix

    That did it! Thank you for your help on the last bit.
    Peter

  6. #6
    Forum Moderator AliGW's Avatar
    Join Date
    08-10-2013
    Location
    Retired in Ipswich, Suffolk, but grew up in Sawley, Derbyshire (England)
    MS-Off Ver
    MS 365 Subscription Insider Beta Channel v. 2404 (Windows 11 22H2 64-bit)
    Posts
    80,719

    Re: Add prefix

    This has nothing to do with VBA as far as I can see, so I'm moving the thread to the correct section.
    Ali


    Enthusiastic self-taught user of MS Excel who's always learning!
    Don't forget to say "thank you" in your thread to anyone who has offered you help.
    You can reward them by clicking on * Add Reputation below their user name on the left, if you wish.

    Forum Rules (updated August 2023): please read them here.

  7. #7
    Valued Forum Contributor mohan.r1980's Avatar
    Join Date
    09-18-2010
    Location
    Mumbai, India
    MS-Off Ver
    Excel 2010 (windows7)
    Posts
    729

    Re: Add prefix

    Quote Originally Posted by Peterino View Post
    That did it! Thank you for your help on the last bit.
    Peter
    Your Welcome and thanks for the rep

  8. #8
    Forum Moderator AliGW's Avatar
    Join Date
    08-10-2013
    Location
    Retired in Ipswich, Suffolk, but grew up in Sawley, Derbyshire (England)
    MS-Off Ver
    MS 365 Subscription Insider Beta Channel v. 2404 (Windows 11 22H2 64-bit)
    Posts
    80,719

    Re: Add prefix

    If that takes care of your original question, please select Thread Tools from the menu link above and mark this thread as SOLVED. Thanks.

  9. #9
    Forum Contributor
    Join Date
    10-22-2014
    Location
    Ontario
    MS-Off Ver
    365
    Posts
    222

    Re: Add prefix

    Is there a way to have Col E work without Col D? So, if C14 is RY.PR.C then E14 is TSE:RY-C. I could then delete Col D.

    Much appreciated.

    Peter
    Attached Files Attached Files

  10. #10
    Forum Moderator AliGW's Avatar
    Join Date
    08-10-2013
    Location
    Retired in Ipswich, Suffolk, but grew up in Sawley, Derbyshire (England)
    MS-Off Ver
    MS 365 Subscription Insider Beta Channel v. 2404 (Windows 11 22H2 64-bit)
    Posts
    80,719

    Re: Add prefix

    Try this:

    =LEFT(VLOOKUP(B11,$B$3:$C$9,2,0),FIND(":",VLOOKUP(B11,$B$3:$C$9,2,0)))&IFERROR(LEFT(C11,FIND(".",C11)-1)&"-"&RIGHT(C11,1),C11)
    Attached Files Attached Files
    Last edited by AliGW; 07-30-2018 at 09:52 AM.

  11. #11
    Forum Moderator AliGW's Avatar
    Join Date
    08-10-2013
    Location
    Retired in Ipswich, Suffolk, but grew up in Sawley, Derbyshire (England)
    MS-Off Ver
    MS 365 Subscription Insider Beta Channel v. 2404 (Windows 11 22H2 64-bit)
    Posts
    80,719

    Re: Add prefix

    Can we mark this as solved yet?

  12. #12
    Forum Contributor
    Join Date
    10-22-2014
    Location
    Ontario
    MS-Off Ver
    365
    Posts
    222

    Re: Add prefix

    That did it. I am not sure how many times I should be adding additional items to my initial request but...

    Sometimes there are lines without data so it would be good to have the formula carry down but not show anything on that blank line. I tried adding an =IF but not sure how to do that here. Sheet attached.

    t RY TSE:RY
    tp RY.PR.C TSE:RY-C
    #N/A
    #N/A
    t EXE TSE:EXE
    Attached Files Attached Files

  13. #13
    Forum Moderator AliGW's Avatar
    Join Date
    08-10-2013
    Location
    Retired in Ipswich, Suffolk, but grew up in Sawley, Derbyshire (England)
    MS-Off Ver
    MS 365 Subscription Insider Beta Channel v. 2404 (Windows 11 22H2 64-bit)
    Posts
    80,719

    Re: Add prefix

    That's easy to resolve:

    =IF(C11="","",LEFT(VLOOKUP(B11,$B$3:$C$9,2,0),FIND(":",VLOOKUP(B11,$B$3:$C$9,2,0)))&IFERROR(LEFT(C11,FIND(".",C11)-1)&"-"&RIGHT(C11,1),C11))

    In terms of adding things to threads: what we would prefer is for you to state all the variables at the outset, because, as you have found, extra details can significantly change the approach needed.

    Now, if we are there, would you please mark the thread as solved? Thanks.

  14. #14
    Forum Contributor
    Join Date
    10-22-2014
    Location
    Ontario
    MS-Off Ver
    365
    Posts
    222

    Re: Add prefix

    That got it. Many thanks to all three for your help. I will make sure I have all variables up front!

    Peter

  15. #15
    Forum Moderator AliGW's Avatar
    Join Date
    08-10-2013
    Location
    Retired in Ipswich, Suffolk, but grew up in Sawley, Derbyshire (England)
    MS-Off Ver
    MS 365 Subscription Insider Beta Channel v. 2404 (Windows 11 22H2 64-bit)
    Posts
    80,719

    Re: Add prefix

    You’re welcome!

    If that takes care of your original question, please select Thread Tools from the menu link above and mark this thread as SOLVED. Thanks.

+ Reply to Thread

Thread Information

Users Browsing this Thread

There are currently 1 users browsing this thread. (0 members and 1 guests)

Similar Threads

  1. Replace one prefix with another prefix
    By uglyduck in forum Excel Programming / VBA / Macros
    Replies: 7
    Last Post: 01-23-2010, 08:24 PM
  2. VBA - xl Prefix
    By ajocius in forum Excel Programming / VBA / Macros
    Replies: 1
    Last Post: 11-26-2005, 04:30 PM
  3. [SOLVED] Prefix
    By Big Boss in forum Excel Formulas & Functions
    Replies: 0
    Last Post: 09-06-2005, 06:05 PM
  4. [SOLVED] Prefix
    By Andy Brown in forum Excel Formulas & Functions
    Replies: 8
    Last Post: 09-06-2005, 06:05 AM
  5. [SOLVED] Prefix
    By Andy Brown in forum Excel Formulas & Functions
    Replies: 12
    Last Post: 09-06-2005, 04:05 AM
  6. Prefix
    By Big Boss in forum Excel Formulas & Functions
    Replies: 0
    Last Post: 09-06-2005, 12:05 AM
  7. Prefix
    By Big Boss in forum Excel Formulas & Functions
    Replies: 0
    Last Post: 09-05-2005, 10:05 PM
  8. [SOLVED] Prefix
    By Big Boss in forum Excel Formulas & Functions
    Replies: 4
    Last Post: 08-10-2005, 11:05 PM

Bookmarks

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts

Search Engine Friendly URLs by vBSEO 3.6.0 RC 1