+ Reply to Thread
Results 1 to 11 of 11

Convert words into numbers

  1. #1
    Registered User
    Join Date
    08-31-2009
    Location
    Amsterdam
    MS-Off Ver
    Excel 2003
    Posts
    4

    Convert words into numbers

    Hi,

    For my research in medicine I build a spreadsheet with google docs. After having received most of the data I transfered the spreadsheet into an excel file. The next thing I would like to do is to convert the words in the spreadsheet into numbers so I can calculate with them. For example: every row in column E consist of one of the two words: 'man' or 'woman'. I would like to convert the word 'man' into a '0' and the word 'woman' into a '1'. Is it possible to write a formula or function for this?

    Thank you very much!

    With kind regards,

    Thomas
    Last edited by Onderzoek; 08-31-2009 at 07:32 AM.

  2. #2
    Registered User
    Join Date
    08-31-2009
    Location
    right here, of course
    MS-Off Ver
    Excel 2007
    Posts
    1

    Re: Convert words into numbers

    Hi,

    It depends on the criteria for your numbering system.

    If there is no relationship between the word and the number, then you could just list all the words in one column, their numbers in the adjacent column and lookup each one.

    If there is some relationship, e.g. words with >3 characters = 1, then you need to explain the relationship.

    HTH

  3. #3
    Registered User
    Join Date
    08-31-2009
    Location
    Amsterdam
    MS-Off Ver
    Excel 2003
    Posts
    4

    Re: Convert words into numbers

    Hi,

    Thank you for your reply. In my database there is a relationship between the numbers. Let me give yoy another example.

    We askeds patients to answer the following question: Do you have pain in your hip? The possible answers are never, sometimes and always. I would like to convert never into 1, sometimes into 2 and always into 3. All the 'points' of the different questions need to be summed up and will give a final 'number' which tells us something about the condition of the patient.

    Do you have any idea how to solve this problem?

    Thanks!

  4. #4
    Forum Moderator zbor's Avatar
    Join Date
    02-10-2009
    Location
    Croatia
    MS-Off Ver
    365 ProPlus
    Posts
    15,602

    Re: Convert words into numbers

    On second sheet you must define all words and their numbers.

    There can be several words that getting same number (never into 1, sometimes into 2 and always into 3) or (yes into 1, maybe into 2 and no into 3) but there can't be same words having different value (1st question Yes into 1,second question Yes into 2, third question Yes into 3).

    Also, it would be nice if you could write all possibilities that you can have:

    1st question -> those answers,
    2nd question-> those answers etc.

    Also, much can depend of how you have sorted your data.
    Some example workbook would be nice.

  5. #5
    Forum Expert martindwilson's Avatar
    Join Date
    06-23-2007
    Location
    London,England
    MS-Off Ver
    office 97 ,2007
    Posts
    19,320

    Re: Convert words into numbers

    you could just use countifs
    =COUNTIF(A1:C10,"never")
    =COUNTIF(A1:C10,"sometimes")*2
    =COUNTIF(A1:C10,"always")*3
    but it does depend as zbor says on your layout.
    "Unless otherwise stated all my comments are directed at OP"

    Mojito connoisseur and now happily retired
    where does code go ?
    look here
    how to insert code

    how to enter array formula

    why use -- in sumproduct
    recommended reading
    wiki Mojito

    how to say no convincingly

    most important thing you need
    Martin Wilson: SPV
    and RSMBC

  6. #6
    Registered User
    Join Date
    08-31-2009
    Location
    Amsterdam
    MS-Off Ver
    Excel 2003
    Posts
    4

    Re: Convert words into numbers

    Thank you Zbor and Yard for your fast replies!

    I've attached a part of my excel file so you can see how I have sorted the data (the language is dutch).

    Lets take column B as an example. I would like to transfer: geen into 1, gering into 2, matig into 3 etc. The 'geen' in column B gets te same number as the 'geen' in all the other columns.

    If it is possible to convert the words into numbers, how do I do that? Do I have to write a formula?

    Thanks again!
    Attached Files Attached Files

  7. #7
    Forum Moderator zbor's Avatar
    Join Date
    02-10-2009
    Location
    Croatia
    MS-Off Ver
    365 ProPlus
    Posts
    15,602

    Re: Convert words into numbers

    Try something like this.

    Also, I add validation list to limit number of answers and reduce number of error...

    Example(1).xls

  8. #8
    Forum Expert martindwilson's Avatar
    Join Date
    06-23-2007
    Location
    London,England
    MS-Off Ver
    office 97 ,2007
    Posts
    19,320

    Re: Convert words into numbers

    you only have a few words to replace?
    use find/replace find geen replace 1
    find gering/ replace 2 and so on
    i did this took about 20 seconds
    Attached Files Attached Files

  9. #9
    Registered User
    Join Date
    08-31-2009
    Location
    Amsterdam
    MS-Off Ver
    Excel 2003
    Posts
    4

    Re: Convert words into numbers

    Thanks a lot! You helped me a great deal!

    Kind regards,

    Thomas

  10. #10
    Forum Moderator zbor's Avatar
    Join Date
    02-10-2009
    Location
    Croatia
    MS-Off Ver
    365 ProPlus
    Posts
    15,602

    Re: Convert words into numbers

    Np.
    Please make thread solved!

  11. #11
    Registered User
    Join Date
    01-01-2012
    Location
    USA
    MS-Off Ver
    Excel 2007
    Posts
    1

    Re: Convert words into numbers

    I just had the same issue and this post helped me a lot. Thank you for your help.

+ 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