+ Reply to Thread
Results 1 to 39 of 39

Split numbers and split words

  1. #1
    Registered User
    Join Date
    05-08-2009
    Location
    Oslo, Norway
    MS-Off Ver
    Excel 2007
    Posts
    23

    Split numbers and split words

    How do I split numbers!

    I have two problems/challenges!

    Part I...
    I got the answer 1987, and now I want Excel to take the numbers out and display...
    1 in one box then i set + in the next, then 9 in the 3ed. box, next box +, then 8, then +, then 7 in the last so that i can have Excel make a SUM of it all to 25.

    How do I split 1987 and put the numbers in different boxes?

    Part II...
    I want to make A=1 B=2... all the way up to 9, then start over again with J=1 K=2... up to 9 again and then over again.

    So that if I write my name it comes out as a value of 14 (Odd = O=6 D=4 D=4 =14)

    (AJSØ=1 BKTÅ=2 CLU=3 DMV=4 ENW=5 FOX=6 GPY=7 HQZ=8 IRÆ=9, It's the Norwegian alphabet, that's why there are some extra letters)

    So how do I set up my Excel so that is ANY name is typed in I can get it out into a number from the values assign?

    Odd K.
    Thank you very much for any help!

    Sorry about the title :D
    Last edited by Oddemann; 05-08-2009 at 11:52 AM. Reason: Fixing titel!

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

    Re: I have two problems/challenges!

    you don't really need to split it if you want the sum you can use
    =SUM(VALUE(MID(B1,ROW($A$1:OFFSET($A$1,LEN(B1)-1,0)),1))) array entered
    with ctrl shift and enter.
    if you must split it out
    i am going to assume the number can be
    any length then its just best to use mid as it saves time
    =--MID($B$1,COLUMN(),1) dragged across from col a will split whats in b1 which you can sum
    you can use the same technique to extract the letters from a name
    but leave off the --
    =MID($B$1,COLUMN(),1)
    then look up each of the letters in a table you would set up somewhere
    Last edited by martindwilson; 05-08-2009 at 05:22 AM.
    "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

  3. #3
    Forum Guru DonkeyOte's Avatar
    Join Date
    10-22-2008
    Location
    Northumberland, UK
    MS-Off Ver
    O365
    Posts
    21,531

    Re: I have two problems/challenges!

    Oddemann, Welcome to the Board.

    Per forum rules please re-title your thread to something more appropriate.

    Re: 1st question
    You need not split the values

    B1: =SUMPRODUCT(LEN(A1)-LEN(SUBSTITUTE(A1,{1,2,3,4,5,6,7,8,9},"")),{1,2,3,4,5,6,7,8,9})
    where A1 holds 1987

    Re: 2nd question

    The simplest thing will be to have a column holding letters of the alphabet and the adjacent column holding the associated value then adopt a similar approach to the above

    D1: =SUMPRODUCT(LEN(C1)-LEN(SUBSTITUTE(C1,F1:F26,"")),G1:G26)
    where C1 holds name and F1:F26 letters of the alphabet and G1:G26 the associated values of each letter... alter ranges accordingly.

  4. #4
    Forum Expert sweep's Avatar
    Join Date
    04-03-2007
    Location
    Great Sankey, Warrington, UK
    MS-Off Ver
    2003 / 2007 / 2010 / 2016 / 365
    Posts
    3,443

    Re: I have two problems/challenges!

    Hi,

    Part 1 - to extract the numbers, use the excel MID function.

    To total all the digits in a cell, =SUMPRODUCT((MID(SUBSTITUTE(A1,".",""),ROW(INDIRECT("1:"&LEN(SUBSTITUTE(A1,".","")))),1)+0))

    You could use a UDF such as the following to convert the letters to numbers

    Please Login or Register  to view this content.
    Rule 1: Never merge cells
    Rule 2: See rule 1

    "Tomorrow I'm going to be famous. All I need is a tennis racket and a hat".

  5. #5
    Valued Forum Contributor mudraker's Avatar
    Join Date
    11-10-2003
    Location
    Melbourne, Australia
    Posts
    3,983

    Re: I have two problems/challenges!

    Oddemann

    Please take a couple of minutes and read ALL the Forum Rules then edit your thread title by following the instructions in the rules (Rule 1) so that it better discribes your problem/request
    Please Read Forum Rules Before Posting
    Wrap VBA code by selecting the code and clicking the # icon or Read This
    How To Cross Post politely

    Top Excel links for beginners to Experts

    If you are pleased with a member's answer then use the Scales icon to rate it
    If my reply has assisted or failed to assist you I welcome your Feedback.

  6. #6
    Registered User
    Join Date
    05-08-2009
    Location
    Oslo, Norway
    MS-Off Ver
    Excel 2007
    Posts
    23

    Re: I have two problems/challenges!

    What should I give it as a title the question?

    Now its "partly" fix, sorry for the bad title! :D

    Tried, but got nowhere fast, so i give you a "picture" of how it looks so i can get a grip of the formula and how to insert it!

    http://www.flickr.com/photos/31335723@N06/3512884128/

    Thank you all for very fast response and some really good answers!

    Odd K.
    Last edited by Oddemann; 05-08-2009 at 07:56 AM.

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

    re: split numbers

    to do it as in your example
    since thats the layout you require
    Attached Files Attached Files

  8. #8
    Registered User
    Join Date
    05-08-2009
    Location
    Oslo, Norway
    MS-Off Ver
    Excel 2007
    Posts
    23

    re: split numbers

    Thank you very much Martind Wilson, got it and i learned how to use in the future too. Thank you very much!

    Working on the next challenge...

    I like this way of doing it: =SUMPRODUCT(LEN(C1)-LEN(SUBSTITUTE(C1,F1:F26,"")),G1:G26)

    But, i have problem getting "C1" to work, I get "Error" on the formula and since I only partly get it I cant figure it out! Can anyone point me in the right direction?

    Here is a picture of it, looks like thats the best way to show what I am working on: http://www.flickr.com/photos/31335723@N06/3512256427/

    I am very impressed with quick answers and the level of knowing Excel.

    Thank you for all the help!

    Odd K.

  9. #9
    Registered User
    Join Date
    05-08-2009
    Location
    Oslo, Norway
    MS-Off Ver
    Excel 2007
    Posts
    23

    Re: Split numbers and split words

    D1: =SUMPRODUCT(LEN(C1)-LEN(SUBSTITUTE(C1,F1:F26,"")),G1:G26)

    All is good in this formula until it gets to the second C1, (C1,F1:F26,"")), I get a error on C1 - what is the error?

    I understand some of the formula, but not everything. So i cant understand what the problem is.

    Odd K.

  10. #10
    Forum Guru DonkeyOte's Avatar
    Join Date
    10-22-2008
    Location
    Northumberland, UK
    MS-Off Ver
    O365
    Posts
    21,531

    Re: Split numbers and split words

    Upload a sample file rather than an image...

    I suspect your issues relate to regional settings - ie our offerings are UK based using , as delimiter as opposed to ; as may be the case for you in Norway.
    Last edited by DonkeyOte; 05-08-2009 at 12:31 PM.

  11. #11
    Forum Guru DonkeyOte's Avatar
    Join Date
    10-22-2008
    Location
    Northumberland, UK
    MS-Off Ver
    O365
    Posts
    21,531

    Re: Split numbers and split words

    [deleted....]

  12. #12
    Registered User
    Join Date
    05-08-2009
    Location
    Oslo, Norway
    MS-Off Ver
    Excel 2007
    Posts
    23

    Re: Split numbers and split words

    =SUMPRODUCT(LEN(C8)-LEN(SUBSTITUTE(C8;F1:F26;""));G1:G26)

    Proofreading... I get the right sum! Was the mistake a lack of ";"?

  13. #13
    Forum Guru DonkeyOte's Avatar
    Join Date
    10-22-2008
    Location
    Northumberland, UK
    MS-Off Ver
    O365
    Posts
    21,531

    Re: Split numbers and split words

    There was no mistake it is simply a case of translation - formula delimiters in XL will vary pending regional settings on the client machine.

  14. #14
    Registered User
    Join Date
    05-08-2009
    Location
    Oslo, Norway
    MS-Off Ver
    Excel 2007
    Posts
    23

    Re: Split numbers and split words

    I now want to test a box with IF

    So IF it has a 3 number, like 109, then its is 9. IF its not 3 numbers then put out 0

    109 So if it is 3 numbers then i get 1 + 0 + 9 = 10 < No problem with the formula, since I have 3 numbers to add!

    58 So if it is 2 numbers then i get 5 + 8 + " " = 13 < No i HAVE a problem with the formula, since I have only 2 numbers to add, the lack of a the 3 digit stops the formula!

    =IF(N13;--MID(N13;3;1);0)

    This formula puts out 9 if there is 3 digits but if its only 2 i get a error in the formula.

    Help, what am i going wrong?

    Odd K.
    Continue testing and playing here!
    Last edited by Oddemann; 05-08-2009 at 02:24 PM. Reason: Better explanation!

  15. #15
    Forum Guru DonkeyOte's Avatar
    Join Date
    10-22-2008
    Location
    Northumberland, UK
    MS-Off Ver
    O365
    Posts
    21,531

    Re: Split numbers and split words

    Perhaps

    =9*AND(N13>=100;N13<=999)

  16. #16
    Forum Expert NBVC's Avatar
    Join Date
    12-06-2006
    Location
    Mississauga, CANADA
    MS-Off Ver
    2003:2010
    Posts
    34,898

    Re: Split numbers and split words

    Oddeman,

    You should start new threads with new questions rather than extended a thread with multiple unrelated questions.
    Where there is a will there are many ways.

    If you are happy with the results, please add to the contributor's reputation by clicking the reputation icon (star icon) below left corner

    Please also mark the thread as Solved once it is solved. Check the FAQ's to see how.

  17. #17
    Registered User
    Join Date
    05-08-2009
    Location
    Oslo, Norway
    MS-Off Ver
    Excel 2007
    Posts
    23

    Re: Split numbers and split words

    Thanks! Worked great! =9*AND(N13>=100;N13<=999)

    But, how dos it work? Dont understand it, it gives the right answers, but I also like to understand it!

    Thank you very much!

    Odd K.
    Testing new formula to learn!

    PS! Should I do this NOW or next time?
    Last edited by Oddemann; 05-08-2009 at 02:33 PM. Reason: New answer!

  18. #18
    Registered User
    Join Date
    05-08-2009
    Location
    Oslo, Norway
    MS-Off Ver
    Excel 2007
    Posts
    23

    Re: Split numbers and split words

    After more testing, I found it to not work as I want! Here its the doc..
    Attached Files Attached Files

  19. #19
    Forum Expert NBVC's Avatar
    Join Date
    12-06-2006
    Location
    Mississauga, CANADA
    MS-Off Ver
    2003:2010
    Posts
    34,898

    Re: Split numbers and split words

    Quote Originally Posted by Oddemann View Post

    PS! Should I do this NOW or next time?
    Next time...

    DonkeyOte can continue to assist here if he desires.

  20. #20
    Forum Guru DonkeyOte's Avatar
    Join Date
    10-22-2008
    Location
    Northumberland, UK
    MS-Off Ver
    O365
    Posts
    21,531

    Re: Split numbers and split words

    Whilst trying to avoid incurring NBVC's wrath...

    How does it work ?

    Well the AND test will return a Boolean of either TRUE or FALSE
    (TRUE will only be returned if the value in N13 is between 100 and 999)

    TRUE when coerced to Integer (via multiplication, addition etc) equates to 1 whereas FALSE coerces to 0, thus:

    =9*TRUE -> 9 * 1 -> 9

    whereas

    =9*FALSE -> 9 * 0 -> 0

  21. #21
    Registered User
    Join Date
    05-08-2009
    Location
    Oslo, Norway
    MS-Off Ver
    Excel 2007
    Posts
    23

    Re: Split numbers and split words

    After testing this, I see that it will not work as I want!

    Thank you for explaining, learning something new is always good.

    I put out the file of how the sheet, and maybe there you can see it more clear?

    Odd K.

  22. #22
    Forum Guru DonkeyOte's Avatar
    Join Date
    10-22-2008
    Location
    Northumberland, UK
    MS-Off Ver
    O365
    Posts
    21,531

    Re: Split numbers and split words

    I don't really see how the file relates to the last question re: 3 digits ... it's also not clear as to whether B5 should be 0 or 1 ... ie B5 relates to 100's, D5 to 10's and F5 to 1's... ie 0, 1, 0 ... if so:

    B5: =INT(H3/100)
    D5: =INT(MOD(H3,100)/10)
    F5: =MOD(H3,10)

    If on the other hand B5 should be 1st digit, D5 2nd digit (if exists) and so forth and 0 if no digit exists then you could use:

    B5: =LOOKUP(10,CHOOSE({1,2},0,0+MID($H3,1,1)))
    D5: =LOOKUP(10,CHOOSE({1,2},0,0+MID($H3,2,1)))
    F5: =LOOKUP(10,CHOOSE({1,2},0,0+MID($H3,3,1)))

    I would suggest you post a clear sample with (multiple) desired results...

  23. #23
    Registered User
    Join Date
    05-08-2009
    Location
    Oslo, Norway
    MS-Off Ver
    Excel 2007
    Posts
    23

    Re: Split numbers and split words

    Here you have 3 of the same calculation...

    When it is 999, it dos not do it correctly, also #3 calculation comes out wrong!

    So I want to put any 3 numbers out as a answer in the first line OR 2. If I only get two digits, then I want it to put "0" in since there is no number on the 3 spot, so that the summery gets a value! And not a error because of lacing a number or the 3 digit!

    Is it easier to understand now?

    Odd K.
    Attached Files Attached Files

  24. #24
    Forum Expert shg's Avatar
    Join Date
    06-20-2007
    Location
    The Great State of Texas
    MS-Off Ver
    2003, 2010
    Posts
    40,678

    Re: Split numbers and split words

    Are these results all correct?
    Please Login or Register  to view this content.
    Entia non sunt multiplicanda sine necessitate

  25. #25
    Registered User
    Join Date
    05-08-2009
    Location
    Oslo, Norway
    MS-Off Ver
    Excel 2007
    Posts
    23

    Re: Split numbers and split words

    Jepp, they are correct!

  26. #26
    Forum Expert shg's Avatar
    Join Date
    06-20-2007
    Location
    The Great State of Texas
    MS-Off Ver
    2003, 2010
    Posts
    40,678

    Re: Split numbers and split words

    =mod(a1 - 1, 9) + 1

  27. #27
    Forum Expert shg's Avatar
    Join Date
    06-20-2007
    Location
    The Great State of Texas
    MS-Off Ver
    2003, 2010
    Posts
    40,678

    Re: Split numbers and split words

    A better formula, compliments of (who else?) Daddylonglegs in another thread, works around the problem described at http://support.microsoft.com/kb/119083

    =A2 - FLOOR(A2 - 1, 9)
    Last edited by shg; 05-09-2009 at 02:54 PM.

  28. #28
    Registered User
    Join Date
    05-08-2009
    Location
    Oslo, Norway
    MS-Off Ver
    Excel 2007
    Posts
    23

    Re: Split numbers and split words

    =H26-(INT(H26/K13)*K13) This one works, then I put the value 1 in K13!

    Thanks for pointing me in the right direction!

    Odd K.

  29. #29
    Registered User
    Join Date
    05-08-2009
    Location
    Oslo, Norway
    MS-Off Ver
    Excel 2007
    Posts
    23

    Re: Split numbers and split words

    Nope, =H26-(INT(H26/K13)*K13) dos not work!

    =mod(a1 - 1, 9) + 1 - This one adds a number that's not there and tips the "scale"

    =A2 - FLOOR(A2 - 1, 9) This one i don't understand! Help?

    Odd K.

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

    Re: Split numbers and split words

    =A2 - FLOOR(A2 - 1, 9)
    q. does it work?
    perhaps another uploaded example would be enlightening if none of those do!

  31. #31
    Registered User
    Join Date
    05-08-2009
    Location
    Oslo, Norway
    MS-Off Ver
    Excel 2007
    Posts
    23

    Re: Split numbers and split words

    Hope this one explains it better!

    Odd K.
    Attached Files Attached Files

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

    Re: Split numbers and split words

    in D34 you have =H32-(INT(H32/B1)*B1)
    why B1 ?
    b1 is text on that sheet it says
    "FN"
    and i have absolutely no idea why you suddenly decided to add 1 in cell F32
    Last edited by martindwilson; 05-10-2009 at 04:05 AM.

  33. #33
    Registered User
    Join Date
    05-08-2009
    Location
    Oslo, Norway
    MS-Off Ver
    Excel 2007
    Posts
    23

    Re: Split numbers and split words

    Just trying the different suggestions I got!

    So that's why there are different things, non of them work and I know that. So those are NOT the solution to my problem! Just me trying to get suggestions to work!

    So all of them are test and non of them are working

    Odd K.

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

    Re: Split numbers and split words

    you have to adjust references yourself so why did you use B1?

  35. #35
    Registered User
    Join Date
    05-08-2009
    Location
    Oslo, Norway
    MS-Off Ver
    Excel 2007
    Posts
    23

    Re: Split numbers and split words

    Because I don't understand the formula, don't understand what B1 should be or where it should point. In B1 I had value 1, and it partly fixed the problem. But on more testing I found it to not work.

    I shamed to say that i don't understand that formula >=H32-(INT(H32/B1)*B1)< at all :|

    Let me try to explain what I want to do...

    FN, will come up with a value!
    MN, MIGHT come up with a value!
    EN, will come up with a value!

    First line summarize it all, it might be 3 number or 2

    The second line I take the answer and split it up, first number in first box, second number in second box and here comes the problem... if I have 3 numbers then it works, because I get a number in the last box. BUT... If i only have 2 numbers I have NO number to put in the last box. Then I want it to put "0", so fare the formula stops the calculation when it has no number.

    Then on the last line I no have 2 numbers that I split into two different boxes and get my last sum! The end! The last number is what I need!

    12+4+14=30 (just two numbers and will have a problem with the second line and the last box. No value!)
    3+0+_=3 (Now I have the next problem, only one number and I will have problem in the last box on the last line!)
    3+_=3

    333+333+333=999
    9+9+9=27
    2+7=9 PERFECT!

    The problem is that I don't always get 3 numbers, and when I only get 2 I need to put "0" as a default value if there is no value!

    Hope I conveyed my problem now! :D

    Odd K.

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

    Re: Split numbers and split words

    see sheet 2
    i assume you will only ever have a max of 3 digits in each of fn mn en?
    Attached Files Attached Files

  37. #37
    Registered User
    Join Date
    05-08-2009
    Location
    Oslo, Norway
    MS-Off Ver
    Excel 2007
    Posts
    23

    Re: Split numbers and split words

    You assume correct!

    Neat and very simple, even I understand those formulas ;-) So simple and so perfect. And I was looking for some SPECIAL formulas :p

    Thank you very much for the help!

    Odd K.

  38. #38
    Forum Expert shg's Avatar
    Join Date
    06-20-2007
    Location
    The Great State of Texas
    MS-Off Ver
    2003, 2010
    Posts
    40,678

    Re: Split numbers and split words

    If all you're after is the single result, you could just do =SUM(A2:C2) - FLOOR(SUM(A2:C2) - 1, 9), irrespective of whether there are 1, 2 or 3 numbers in A2:C2.

  39. #39
    Registered User
    Join Date
    05-08-2009
    Location
    Oslo, Norway
    MS-Off Ver
    Excel 2007
    Posts
    23

    Re: Split numbers and split words

    Shg, very nice ;-) And yes I will use that too, BUT... I want to show the calculation so that it can be checked.

    Will have to look into "FLOOR to see how that one works. Thanks for yet another solution ;-)

    Odd K.

+ 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