+ Reply to Thread
Results 1 to 18 of 18

Help converting a word to a number value

  1. #1
    Registered User
    Join Date
    06-05-2013
    Location
    VA
    MS-Off Ver
    Excel 2010
    Posts
    8

    Help converting a word to a number value

    Hello all. I am trying to create a spreadsheet to keep track of an online racing league that I'm in. I have created columns for the racers, and rows for the races. What I would like to do is type in 1st, and it represent the number 13 for when I do an autosum at the bottom of that column. It would be easier for me to type in the position place, instead of the points value. The position place will always carry the name numeric value. Here is what I have so far:

    Start & Park Season 1.xlsm
    Attached Files Attached Files
    Last edited by warpedsoul; 06-07-2013 at 11:22 AM.

  2. #2
    Forum Expert tigeravatar's Avatar
    Join Date
    03-25-2011
    Location
    Colorado, USA
    MS-Off Ver
    Excel 2003 - 2013
    Posts
    5,361

    Re: Help converting a word to a number value

    warpedsoul,

    Welcome to the forum!
    In cell D41 and copied right:
    Please Login or Register  to view this content.
    Hope that helps,
    ~tigeravatar

    Forum Rules: How to use code tags, mark a thread solved, and keep yourself out of trouble

  3. #3
    Registered User
    Join Date
    06-05-2013
    Location
    VA
    MS-Off Ver
    Excel 2010
    Posts
    8

    Re: Help converting a word to a number value

    Quote Originally Posted by tigeravatar View Post
    warpedsoul,

    Welcome to the forum!
    In cell D41 and copied right:
    Please Login or Register  to view this content.
    Im not sure that I follow your reply.

    To help clarify, on the spreadsheet I attacked, for example, if I put "1st" in cell D2, I would like for it to work with autosum and have 13 in cell D41. If I put "3rd" in cell D3, then cell D41 becomes 20.

  4. #4
    Forum Expert Jakobshavn's Avatar
    Join Date
    08-17-2012
    Location
    Lakehurst, NJ, USA
    MS-Off Ver
    Excel 2007
    Posts
    1,970

    Re: Help converting a word to a number value

    Here is a macro-based solution.
    If you enter 1st (or other words from your table) in a cell, it will automatically be converted to the correct numerical value.
    Macros must be enabled for this to work!
    Attached Files Attached Files
    Gary's Student

  5. #5
    Registered User
    Join Date
    06-05-2013
    Location
    VA
    MS-Off Ver
    Excel 2010
    Posts
    8

    Re: Help converting a word to a number value

    Quote Originally Posted by Jakobshavn View Post
    Here is a macro-based solution.
    If you enter 1st (or other words from your table) in a cell, it will automatically be converted to the correct numerical value.
    Macros must be enabled for this to work!
    Thanks. That does help. Is there any way to have the words "1st" "2nd" etc stay in the field, but the number still be represented?

  6. #6
    Forum Expert tigeravatar's Avatar
    Join Date
    03-25-2011
    Location
    Colorado, USA
    MS-Off Ver
    Excel 2003 - 2013
    Posts
    5,361

    Re: Help converting a word to a number value

    Oh i see, you put 1st, 2nd, etc instead of just 1, 2, etc. A formula to account for that would probably be kinda long and ugly. Jakobshavn's macro solution should work just fine for you though

  7. #7
    Forum Expert Jakobshavn's Avatar
    Join Date
    08-17-2012
    Location
    Lakehurst, NJ, USA
    MS-Off Ver
    Excel 2007
    Posts
    1,970

    Re: Help converting a word to a number value

    This should do it:
    Attached Files Attached Files

  8. #8
    Registered User
    Join Date
    06-05-2013
    Location
    VA
    MS-Off Ver
    Excel 2010
    Posts
    8

    Re: Help converting a word to a number value

    Quote Originally Posted by Jakobshavn View Post
    This should do it:
    You, sir, are the man! Thanks so much! If it isn't a long process, care to explain how?

  9. #9
    Forum Expert Jakobshavn's Avatar
    Join Date
    08-17-2012
    Location
    Lakehurst, NJ, USA
    MS-Off Ver
    Excel 2007
    Posts
    1,970

    Re: Help converting a word to a number value

    Sure:

    1. the macro detects any change to the large results table
    2. the macro looks for the word in your small translate table
    3. if the word is found, the macro replaces the word with the appropriate value
    4. the macro applies a "cheater" format to the cell

    The "cheater" format makes the cell look like the typed word, but actually it has a numerical value.

    That is, the cell displays 1st, but the formula bar reveals that it is actually 13.

  10. #10
    Forum Expert GeneralDisarray's Avatar
    Join Date
    09-15-2011
    Location
    Pittsburgh, PA, USA
    MS-Off Ver
    Windows Excel 2016
    Posts
    1,416

    Re: Help converting a word to a number value

    Sort the list the other way, add a placeholder for the list (---) and validate the range..


    viola. see attached example


    formula needed: =SUMPRODUCT(IF(MATCH(D2:D40,$B45:$B55,0)=10,13,IF(MATCH(D2:D40,$B45:$B55,0)=11,0,MATCH(D2:D40,$B45:$B55,0))))
    Attached Files Attached Files
    Last edited by GeneralDisarray; 06-05-2013 at 02:38 PM.
    Remember, saying thanks only takes a second or two. Click the star icon(*) below the post you liked, to give some Rep if you think an answer deserves it.

    Please,mark your thread [SOLVED] if you received your answer.

  11. #11
    Registered User
    Join Date
    06-05-2013
    Location
    VA
    MS-Off Ver
    Excel 2010
    Posts
    8

    Re: Help converting a word to a number value

    Quote Originally Posted by Jakobshavn View Post
    Sure:

    1. the macro detects any change to the large results table
    2. the macro looks for the word in your small translate table
    3. if the word is found, the macro replaces the word with the appropriate value
    4. the macro applies a "cheater" format to the cell

    The "cheater" format makes the cell look like the typed word, but actually it has a numerical value.

    That is, the cell displays 1st, but the formula bar reveals that it is actually 13.
    How do i edit if I wanted to add more racers?

  12. #12
    Forum Expert Jakobshavn's Avatar
    Join Date
    08-17-2012
    Location
    Lakehurst, NJ, USA
    MS-Off Ver
    Excel 2007
    Posts
    1,970

    Re: Help converting a word to a number value

    This version fixes the formula in row #41 to work for racer #10. To add more racers, you would need to extend the formulas in row #41 and do a one-line update to the macro to cover the additional columns for the additional racers.
    Attached Files Attached Files

  13. #13
    Registered User
    Join Date
    06-05-2013
    Location
    VA
    MS-Off Ver
    Excel 2010
    Posts
    8

    Re: Help converting a word to a number value

    Quote Originally Posted by GeneralDisarray View Post
    Sort the list the other way, add a placeholder for the list (---) and validate the range..


    viola. see attached example


    formula needed: =SUMPRODUCT(IF(MATCH(D2:D40,$B45:$B55,0)=10,13,IF(MATCH(D2:D40,$B45:$B55,0)=11,0,MATCH(D2:D40,$B45:$B55,0))))

    This is very helpful too. Thanks you. I didn't think about doing it this way.

  14. #14
    Registered User
    Join Date
    06-05-2013
    Location
    VA
    MS-Off Ver
    Excel 2010
    Posts
    8

    Re: Help converting a word to a number value

    Quote Originally Posted by Jakobshavn View Post
    This version fixes the formula in row #41 to work for racer #10. To add more racers, you would need to extend the formulas in row #41 and do a one-line update to the macro to cover the additional columns for the additional racers.
    I can't find where to edit the macro lol.

  15. #15
    Forum Expert Jakobshavn's Avatar
    Join Date
    08-17-2012
    Location
    Lakehurst, NJ, USA
    MS-Off Ver
    Excel 2007
    Posts
    1,970

    Re: Help converting a word to a number value

    To change the macro to accommodate additional racers, right-click the tabname at the bottom of the Excel window and choose View Code. The single line to change is:

    Set Results = Range("D2:M40")

    The M is for racer #10. To handle 11 racers, use:

    Set Results = Range("D2:N40")

    and follow this pattern for each racer added
    Last edited by Jakobshavn; 06-05-2013 at 03:06 PM.

  16. #16
    Forum Expert GeneralDisarray's Avatar
    Join Date
    09-15-2011
    Location
    Pittsburgh, PA, USA
    MS-Off Ver
    Windows Excel 2016
    Posts
    1,416

    Re: Help converting a word to a number value

    did you try the other way? (post #10) you can get it to happen w/o a macro

  17. #17
    Registered User
    Join Date
    06-05-2013
    Location
    VA
    MS-Off Ver
    Excel 2010
    Posts
    8

    Re: Help converting a word to a number value

    Quote Originally Posted by GeneralDisarray View Post
    did you try the other way? (post #10) you can get it to happen w/o a macro
    I have. I will use that one as an alternative.

    Also, I'm looking to input a season rank section that includes total points accrued and sorts by rank. I have updated the OP with the updated spreadsheet

  18. #18
    Forum Expert Jakobshavn's Avatar
    Join Date
    08-17-2012
    Location
    Lakehurst, NJ, USA
    MS-Off Ver
    Excel 2007
    Posts
    1,970

    Re: Help converting a word to a number value

    Hi warpedsoul:

    Attached is a version with a rank table. Since we are using the Excel Rank() worksheet function, tied scores will have the same rank. See Excel Help for RANK for a more complete explanation.
    Attached Files Attached Files

+ Reply to Thread

Thread Information

Users Browsing this Thread

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

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