+ Reply to Thread
Results 1 to 11 of 11

Split out text and No. from a Cell

  1. #1
    Registered User
    Join Date
    02-01-2011
    Location
    California, Sacramento
    MS-Off Ver
    Excel 2010
    Posts
    92

    Split out text and No. from a Cell

    In the attached workbook I am looking for a formula or an edit to the current function that will split out text and numbers from a cell. The function currently works as shown in row three of the workbook and splits out data as required. However the data (which is downloaded from the web), has changed in certain instances (see row 53) and the function no longer works correctly for those instances.

    Any help will be appreciated.

    Thank you in advance as always,

    BigDawg15
    Attached Files Attached Files

  2. #2
    Forum Expert
    Join Date
    08-12-2012
    Location
    Sydney, Australia
    MS-Off Ver
    Excel 2010
    Posts
    5,636

    Re: Split out text and No. from a Cell

    its hard to control what websites actually put up on their sites

    instead of ESPN try FBS website for data
    http://www.fbschedules.com/ncaa/coll...l-schedule.php

    here is what i came up with
    no fancy UDF but it works
    Attached Files Attached Files
    If you are satisfied with the solution(s) provided, please mark your thread as Solved.
    Select Thread Tools-> Mark thread as Solved. To undo, select Thread Tools-> Mark thread as Unsolved.

  3. #3
    Administrator 6StringJazzer's Avatar
    Join Date
    01-27-2010
    Location
    Tysons Corner, VA, USA
    MS-Off Ver
    MS365 Family 64-bit
    Posts
    24,721

    Re: Split out text and No. from a Cell

    Try this. The problem is that the pattern does not actually require a comma to be present. It is using one pattern twice, to look on each side of a comma, but it never checks for the comma.

    This version uses a single pattern to match the entire string. It produces a single match, and has four submatches, so it loops four times to capture each submatch. I tested this on your data. I also changed it so that it always returns an array of four strings, which makes it much easier to test.

    Please Login or Register  to view this content.
    Jeff
    | | |會 |會 |會 |會 | |:| | |會 |會
    Read the rules
    Use code tags to [code]enclose your code![/code]

  4. #4
    Registered User
    Join Date
    02-01-2011
    Location
    California, Sacramento
    MS-Off Ver
    Excel 2010
    Posts
    92

    Re: Split out text and No. from a Cell

    Quote Originally Posted by 6StringJazzer View Post
    Try this. The problem is that the pattern does not actually require a comma to be present. It is using one pattern twice, to look on each side of a comma, but it never checks for the comma.[/code]
    Guys,

    From your responses it appears I left something out. The new attached workbook should make it clearer. The team names contain "vs." until the game is played. After which the "vs." is deleted and a comma is inserted with the score for each team.

    Teams that are in the top 25 rankings will have their number in front of their name (ie No.1).

    I have tried the FBS website in the past but the formatting changes quite frequently and it is not updated in a timely manner with scores like ESPN. The ESPN website has worked great for the last 3 years, but this year they added the "No." and is throwing everything off.

    Sorry for not making it clearer from the onset. The new workbook should make it clearer.
    In my actual workbook, the score data is updated automatically and feeds the other worksheets.

    Thanks again for your assistance.

    BigDawg15
    Attached Files Attached Files

  5. #5
    Administrator 6StringJazzer's Avatar
    Join Date
    01-27-2010
    Location
    Tysons Corner, VA, USA
    MS-Off Ver
    MS365 Family 64-bit
    Posts
    24,721

    Re: Split out text and No. from a Cell

    I made assumptions that are consistent with what you just described and my code works for both your original workbook and the one you just attached. Have you tried it?

  6. #6
    Registered User
    Join Date
    02-01-2011
    Location
    California, Sacramento
    MS-Off Ver
    Excel 2010
    Posts
    92

    Re: Split out text and No. from a Cell

    6StringJazzer,

    Yes, I have tried the function you provided in the last attached workbook. The only thing that comes up is the first team name (ie No. 10 Utah or Nevada etc.) I have tried entering the formula as an array and without and it does not change the output.

    It appears your function is working correctly for the first team name but not the first team name and score and second team and score. I must be doing something wrong but the output is not as expected.

    Thanks for your patience and guidence.

    BigDawg15

  7. #7
    Administrator 6StringJazzer's Avatar
    Join Date
    01-27-2010
    Location
    Tysons Corner, VA, USA
    MS-Off Ver
    MS365 Family 64-bit
    Posts
    24,721

    Re: Split out text and No. from a Cell

    I am just not seeing a problem. See the attached with my code, and additional fake test data. If this still isn't what you are expecting then you will need to provide a file that you have set up manually to show what results you want.
    teamscore.png
    Attached Files Attached Files

  8. #8
    Registered User
    Join Date
    02-01-2011
    Location
    California, Sacramento
    MS-Off Ver
    Excel 2010
    Posts
    92

    Re: Split out text and No. from a Cell

    6StringJazzer,

    Thanks again for all your help. I downloaded your example and it worked as expected. I then copied the Function and reentered the formulas and no dice. Please see the attached actual workbook and worksheet "sheet100update", row 51.

    Thanks again, its something probably stupid that I am doing on my end, but can't figure it out.

    Regards,

    BigDawg15

    Mike

    PS If you have a different idea to make it work or something I should change, please feel free to let me know.
    Attached Files Attached Files

  9. #9
    Registered User
    Join Date
    02-01-2011
    Location
    California, Sacramento
    MS-Off Ver
    Excel 2010
    Posts
    92

    Re: Split out text and No. from a Cell

    Here's a screenshot of what I'm talking about on my end.

    TeamsExample.jpg

    Thank you,

    Mike

  10. #10
    Administrator 6StringJazzer's Avatar
    Join Date
    01-27-2010
    Location
    Tysons Corner, VA, USA
    MS-Off Ver
    MS365 Family 64-bit
    Posts
    24,721

    Re: Split out text and No. from a Cell

    When I take the example from your file (row 51) and paste it to my file, with the same code, it works. I cannot see anything wrong in the way you are using the formula. I will continue to look as time permits.

    By the way, doing this with a function that returns an array is what I might call tricky--it certainly can work but it's less obvious what's going on. Here is a slightly different way to do it that provides a workaround. This one adds another argument to say which item to return, avoiding returning an array. It no longer requires an array formula.
    Attached Files Attached Files

  11. #11
    Registered User
    Join Date
    02-01-2011
    Location
    California, Sacramento
    MS-Off Ver
    Excel 2010
    Posts
    92

    Re: Split out text and No. from a Cell

    6StringJazzer,

    The work around works just fine. Thank you so much for your patience and help.

    I would be interested if you ever find the problem with the other. If not, no big deal,
    I have a working solution. Hopefully they won't change the formatting again next year!

    Merry Christmas and Happy New Year!

    Cheers,

    Mike

+ 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. [SOLVED] Split Text from cell
    By Brawnystaff in forum Excel Programming / VBA / Macros
    Replies: 8
    Last Post: 06-01-2014, 01:27 PM
  2. [SOLVED] Split text in a cell
    By dougmorgan in forum Excel Formulas & Functions
    Replies: 9
    Last Post: 05-23-2013, 12:48 PM
  3. Split text in a cell
    By Ohio River Greg in forum Excel General
    Replies: 2
    Last Post: 10-03-2011, 03:44 PM
  4. split text from one cell
    By duda in forum Excel General
    Replies: 5
    Last Post: 01-17-2011, 04:40 PM
  5. Split text to next cell down
    By drawing.blanks in forum Excel Programming / VBA / Macros
    Replies: 1
    Last Post: 10-02-2009, 03:31 AM

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