Excel Help Please

I’ve spent the last 30 minutes trying to pull the tickers out of this column in Excel without any luck. I’m sure one of you gurus can do this in your sleep so any help is appreciated.

Here is a small sample of the data in Column A:

1-800 FLOWERS COM FLWS 1ST SOURCE CORP SRCE 1ST UNITED BANCORP INC FUBC 21ST CENTURY FOX INC FOXA 22ND CENTY GROUP INC XXII 2U INC TWOU 3D SYSTEMS CORP DDD 3M CO MMM 8X8 INC NEW EGHT A H BELO CORP AHC I would like to strip out the tickers which are at the end of the text string. Is this possible?

Hi Chad - just use the right function with a length of 4, and then use trim to remove any spaces where the ticker is only 3 characters long.

ie =right(A1,4)

then =trim()

That is genius! Thank you!

Glad to help. Great site, by the way.

Spoke to soon. You are close though. Here is what happens when tickers are shorter than 3 characters:

ZEP INC ZEP ZEP ZILLOW INC Z NC Z ZIMMER HOLDINGS INC ZMH ZMH ZIONS BANCORPORATION ZION ZION ZIOPHARM ONCOLOGY INC ZIOP ZIOP ZIX CORP ZIXI ZIXI ZOES KITCHEN INC ZOES ZOES ZOETIS INC ZTS ZTS ZOGENIX INC ZGNX ZGNX ZULILY INC ZU C ZU ZUMIEZ INC ZUMZ ZUMZ ZYNGA INC ZNGA ZNGA

Chad, i’d love to help. But I can’t think straight with all these distracting trolls. If only someone could clear my mind :slight_smile:

Try using conditional ifs to determine the length of the ticker first?

Didn’t think of that. After you trim you can use the find function to locate the position of spaces in the remaining text.

=find(" ",B1,1)

You’ll get errors for when no spaces are found, but you should get a position of 2 for the space when the ticker is either one or two characters long. For those records do another right function for a length of 2, and then trim again for tickers that are one character long.

=TRIM(RIGHT(SUBSTITUTE(A1," “,REPT(” ",255)),255))

where A1 is the cell with company name.

Because of a variable number of spaces, I’m not sure there is a single formula answer here. You may need to go through several iterations of trimming and finding. I’m pretty sure a mildly competent person could write something in VBA that would solve this problem in 30 seconds. I am not that mildly competetent person.

I tried that and it didn’t work. I didn’t have a space between my quotation marks. This is in fact the answer though.

This is my “power Excel” answer. Just highlight your data cells, click the Data menu -> Text to Columns. Choose “Delimited”, and set the divider to “Space”. This will tokenize your data into cells that are split by the spaces in the original fields.

Filed under things much easier to do with python.

What you really want is

RIGHT(A1,X)

where X changes based on how long the ticker is, or

RIGHT(A1,LEN(A1)-Y)

where Y is a cell that can identify where the last space in the string is.

The first would be easier if you have an excel function that reverses the order of the string (so Ford F becomes F droF), since then you can use search(" ",A1,1) to get the amount of text until the first space. I don’t think that’s built-in to excel, so the alternative (outside of creating a UDF) would be to identify where the last space is. I put

IFERROR(SEARCH(" “,$A1,1),”")

in B1

and then

IFERROR(SEARCH(" “,$A1,B1+1),”")

in C1 and then copy this over as far as appropriate.

then do something like

MAX(B1:H1)

in I1. Finally,

RIGHT(A1,LEN(A1)-I1)

will give you just the ticker.

=RIGHT(A1,LEN(A1)-FIND("*",SUBSTITUTE(A1," “,”*",LEN(A1)-LEN(SUBSTITUTE(A1," “,”")))))

A1 = Text String

I added this to the last column and it seems to work great:

=RIGHT(C1,(4-D1))

I tested all of the other functions and they all gave me #NAME? errors. I’m using Excel 2010 with the analysis toolpak installed.

There is so much I don’t know in Excel.

At first I thought the same thing, but I wasn’t able to get it to work, since some of the names have two words “Pepsi Inc” and some have several words “First National Bank Corporation of New Jersey Inc.”

That’s so weird. Both mine and villnius’s suggestion work. You just have to retype the quotations. For some reason, the quotations are different on AF.

I replaced the quotes and they work perfectly. Thank you!

Hi! I’ve been a really long time lurker on this forum. I stumbled upon it after I was through with the exams, but needed some info on an excel or valuation problem I was having and I found it here, so I guess I can return the favor. Wanted to write this earlier, but I had to wait until my account was approved. Nonetheless, maybe this will help you or someone else. I believe the function in Excel VBA (not a big fan) would be: Function getTicker(str As String) Dim parts As Variant parts = VBA.Split(str) getTicker = parts(UBound(parts)) End Function @jmh530 Yeah, in python it would just be (and I got this from the top of my head): def getTicker(str): ticker = str.split(’ ')[-1] return ticker

^Posting in WC with just one post? Ban him!!!