Hello all,
I need to programatically replace every other space in a cell with a pipe symbol, in order to seperate stock symbols and their market indicators from each other. For example, right now I have 3,500 rows with data that looks like this:
BBCA IJ BZG2 GR PBCRF US
which I need to turn into this
BBCA IJ | BZG2 GR | PBCRF US
The length of the tickers is unpredicatble, but the pattern is consistent.
Any ideas?
Thanks!
Last edited by JP Romano; 03-11-2010 at 10:50 AM. Reason: Resolved
Code:Function OddPipes(s As String) As String Dim astr() As String Dim i As Long astr = Split(s, " ") For i = 1 To UBound(astr) - 1 Step 2 astr(i) = astr(i) & " |" Next i OddPipes = Join(astr, " ") End Function
Microsoft MVP - Excel
Entia non sunt multiplicanda sine necessitate
Shg, you continue to amaze me, and as a result, I amaze my manager (being that I take full credit for whatever I can). YOU ROCK
There are currently 1 users browsing this thread. (0 members and 1 guests)
Bookmarks