+ Reply to Thread
Results 1 to 29 of 29

LEN Function, Get rid of 0.333333 and replace by 0 (zeroe)

  1. #1
    Forum Contributor
    Join Date
    10-21-2012
    Location
    miami, florida usa
    MS-Off Ver
    Excel 2007
    Posts
    260

    LEN Function, Get rid of 0.333333 and replace by 0 (zeroe)

    Hi Friends,

    I'm using a Len Function to count some digits with in string.

    For Example, in G12 Down I have :

    _____G:12_____________
    12 l 10-16-17-22-23 l
    13 l 03-11-14-24-26 l
    14 l 17-19-25-28-35 l


    So in next Cell i'm using LEN Function to do the count,
    Please Login or Register  to view this content.
    Note : i changed/combined the digits after the plus sign, Also i add TRIM but it didn't work
    it get changed for other s fraction..


    When LEN find
    1 Digit, it write 1 <- Perfect
    2 Digit, it write 2 <- Perfect
    3 Digit, it write 3 <- Perfect
    BUT
    When LEN find 0 Digit, it write 0.333333 <- IMPERFECT Lol

    i would like to replace the 0.333333 to 0 (Just the Digit zeroe)

    How can i do that ?, any help please?


    Best regards

    David

  2. #2
    Forum Expert Tony Valko's Avatar
    Join Date
    12-31-2011
    Location
    Pittsburgh
    MS-Off Ver
    2002, 2007:2013
    Posts
    18,890

    Re: LEN Function, Get rid of 0.333333 and replace by 0 (zeroe)



    What exactly are you wanting to do?
    Biff
    Microsoft MVP Excel
    Keep It Simple Stupid

    Let's Go Pens. We Want The Cup.

  3. #3
    Forum Guru AlKey's Avatar
    Join Date
    07-20-2009
    Location
    Lakeland, FL USA
    MS-Off Ver
    Microsoft Office 2010/ Office 365
    Posts
    8,903

    Re: LEN Function, Get rid of 0.333333 and replace by 0 (zeroe)

    Maybe this

    =INT(LEN(G12)+1/3)
    If you like my answer please click on * Add Reputation
    Don't forget to mark threads as "Solved" if your problem has been resolved

    "Nothing is so firmly believed as what we least know."
    --Michel de Montaigne

  4. #4
    Administrator FDibbins's Avatar
    Join Date
    12-29-2011
    Location
    Duncansville, PA USA
    MS-Off Ver
    Excel 7/10/13/16/365 (PC ver 2310)
    Posts
    52,946

    Re: LEN Function, Get rid of 0.333333 and replace by 0 (zeroe)

    Why are you adding +1/3? that is what is causing the 0.3333333
    1. Use code tags for VBA. [code] Your Code [/code] (or use the # button)
    2. If your question is resolved, mark it SOLVED using the thread tools
    3. Click on the star if you think someone helped you

    Regards
    Ford

  5. #5
    Forum Contributor
    Join Date
    10-21-2012
    Location
    miami, florida usa
    MS-Off Ver
    Excel 2007
    Posts
    260

    Re: LEN Function, Get rid of 0.333333 and replace by 0 (zeroe)

    Hi mr tony,

    Yes, i made a mistake on my first post.

    It have to do with G12, and with Other Cell AM9 (was hidden)

    Im Using GetMatch Function to see if AM9 Match G12 down.

    In Cell AM9 is the following combination -> 03-13-20-21-34

    and (red numbers are the match )

    Now, if we observe in G12 and G14 have no match any digit from AM9,But G13 it have a 1 match
    _____G:12_____________R12____
    12 l 10-16-17-22-23 l 0.333333 l
    13 l 03-11-14-24-26 l 1 l
    14 l 17-19-25-28-35 l 0.333333 l

    So, the LEN Function count and show If how many numbers got matched

    Everything is find, except that when LEN find out a No match or 0 Match
    in Cell R12, It show 0.333333, and i would like to get Just the 0 (the digit zero)

    btw the LEN is located in Cell AH13

    Don't know if was explained correct..sorry


    Thank you!!!

    Best regards

    David
    Last edited by david gonzalez; 03-15-2014 at 08:19 PM. Reason: deleted extra letters

  6. #6
    Forum Contributor
    Join Date
    10-21-2012
    Location
    miami, florida usa
    MS-Off Ver
    Excel 2007
    Posts
    260

    Re: LEN Function, Get rid of 0.333333 and replace by 0 (zeroe)

    Hi Mr FDibbin,

    If i don't add the +1/3, It count more, 2 ( and should be 1)

    With out it the plus tinghi, the 03 It count as 2 digit, not as 1 number ..


    Thanks

    David

  7. #7
    Forum Contributor
    Join Date
    10-21-2012
    Location
    miami, florida usa
    MS-Off Ver
    Excel 2007
    Posts
    260

    Re: LEN Function, Get rid of 0.333333 and replace by 0 (zeroe)

    Mr Mr Alley,
    If I
    Please Login or Register  to view this content.
    then it get count the 2 digits instead of 1 number


    Thanks


    David
    Last edited by david gonzalez; 03-15-2014 at 08:32 PM. Reason: add the / inside the of the bracket of last code word

  8. #8
    Forum Expert Tony Valko's Avatar
    Join Date
    12-31-2011
    Location
    Pittsburgh
    MS-Off Ver
    2002, 2007:2013
    Posts
    18,890

    Re: LEN Function, Get rid of 0.333333 and replace by 0 (zeroe)

    Is this for a lottery program?

    If so, it would probably be easier to put each number in its own individual cell.

  9. #9
    Forum Contributor
    Join Date
    10-21-2012
    Location
    miami, florida usa
    MS-Off Ver
    Excel 2007
    Posts
    260

    Re: LEN Function, Get rid of 0.333333 and replace by 0 (zeroe)

    Hi Mr Tony,

    Yes, is more easier, but most of the VBA code are maded to work in a single cell,
    that's why it get a lil difficult to deal with..



    Best regards

    David

  10. #10
    Forum Expert Tony Valko's Avatar
    Join Date
    12-31-2011
    Location
    Pittsburgh
    MS-Off Ver
    2002, 2007:2013
    Posts
    18,890

    Re: LEN Function, Get rid of 0.333333 and replace by 0 (zeroe)

    Well, I'm not much of a programmer so I can't be much help with VBA problems.

    Good luck!

  11. #11
    Administrator FDibbins's Avatar
    Join Date
    12-29-2011
    Location
    Duncansville, PA USA
    MS-Off Ver
    Excel 7/10/13/16/365 (PC ver 2310)
    Posts
    52,946

    Re: LEN Function, Get rid of 0.333333 and replace by 0 (zeroe)

    Quote Originally Posted by david gonzalez View Post
    Hi Mr FDibbin,

    If i don't add the +1/3, It count more, 2 ( and should be 1)

    With out it the plus tinghi, the 03 It count as 2 digit, not as 1 number ..
    What am I missing here?

    You have a formula that is counting the lenth of a string in a cell. That length is 21 characters, including the pipes and the spaces. Unless you change the contents of the cell, that will not change.

    By adding 1/3 on the end, you are not chagingthe contents in anyway, all you are doing is changing it from 21 to 21.33333

    12 l 10-16-17-22-23 l

    Based on your sample above, what is your expected answer?

  12. #12
    Forum Contributor
    Join Date
    10-21-2012
    Location
    miami, florida usa
    MS-Off Ver
    Excel 2007
    Posts
    260

    Re: LEN Function, Get rid of 0.333333 and replace by 0 (zeroe)

    Hi Mr Tony,

    Today started to learn the VBA for dummy, hope my old head catch all of the basic on programming..

    Thank you Sir!!

    Best regards

    David

  13. #13
    Forum Guru AlKey's Avatar
    Join Date
    07-20-2009
    Location
    Lakeland, FL USA
    MS-Off Ver
    Microsoft Office 2010/ Office 365
    Posts
    8,903

    Re: LEN Function, Get rid of 0.333333 and replace by 0 (zeroe)

    We'll, I guess we learnt nothing

  14. #14
    Forum Contributor
    Join Date
    10-21-2012
    Location
    miami, florida usa
    MS-Off Ver
    Excel 2007
    Posts
    260

    Re: LEN Function, Get rid of 0.333333 and replace by 0 (zeroe)

    Hi Mr FDibbin,

    Okay, lets me explain you skipping the content of cell G12.

    I'm using a Get Match Formula to get some match between Cell G12 and AM9
    (numbers with leading zero, and using dash "-")

    then the matched numbers are showed in Cell R12 down
    Example :

    Numbers
    matched___l_LEN Here_
    __R12____l___AH13__
    ___21_____l____1____ <-- Correct count 1
    ___0______l_0.333333 <-- When no match or 0 match LEN Count as 0.333333
    ___0______l_0.333333 <-- When no match or 0 match LEN Count as 0.333333
    ___13_____l___1_____ <-- Correct count 1
    ___20_____l___1_____ <-- Correct count 1
    ___03_____l___1_____ <-- Correct count 1
    ___0______l_0.333333 <-- When no match or 0 match LEN Count as 0.333333
    ___13-20__l___2_____ <-- Correct count 2
    ___03-13__l___2_____ <-- Correct count 2
    ___0______l_0.333333 <-- When no match or 0 match LEN Count as 0.333333



    Thanks

    David

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

    Re: LEN Function, Get rid of 0.333333 and replace by 0 (zeroe)

    back to what i said umpteen posts ago put everything in separate cells
    from the start you can use code to do that
    you can always split your original date with text to columns using - as a delimiter it would save loads of effort
    "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

  16. #16
    Forum Contributor
    Join Date
    10-21-2012
    Location
    miami, florida usa
    MS-Off Ver
    Excel 2007
    Posts
    260

    Re: LEN Function, Get rid of 0.333333 and replace by 0 (zeroe)

    Hi Mr Alkey,

    I started today with VBA, i don't know how long it takes me to deliver a basic code, LOL


    Thanks

    David

  17. #17
    Forum Guru AlKey's Avatar
    Join Date
    07-20-2009
    Location
    Lakeland, FL USA
    MS-Off Ver
    Microsoft Office 2010/ Office 365
    Posts
    8,903

    Re: LEN Function, Get rid of 0.333333 and replace by 0 (zeroe)

    =If(r12=0,0,your formula

  18. #18
    Forum Contributor
    Join Date
    10-21-2012
    Location
    miami, florida usa
    MS-Off Ver
    Excel 2007
    Posts
    260

    Re: LEN Function, Get rid of 0.333333 and replace by 0 (zeroe)

    Hi Mr Martindwilson,

    Yes is true, i have to organize everything on my sheet, in order to start using separated cells
    most of the time i get stuck, due to "-" and single cell tinghi.

    Thank you sir,


    Best regards

    David

  19. #19
    Forum Contributor
    Join Date
    10-21-2012
    Location
    miami, florida usa
    MS-Off Ver
    Excel 2007
    Posts
    260

    Re: LEN Function, Get rid of 0.333333 and replace by 0 (zeroe)

    Hi Mr Alkey,

    =If(r12=0,0,your formula
    You mean the LEN formula with the plus?

    I tried and when found zero, is identified like 0, but when find 1 or 2,It still identify like zero..

    I get lost... lol


    Thanks


    David

  20. #20
    Forum Expert Tony Valko's Avatar
    Join Date
    12-31-2011
    Location
    Pittsburgh
    MS-Off Ver
    2002, 2007:2013
    Posts
    18,890

    Re: LEN Function, Get rid of 0.333333 and replace by 0 (zeroe)

    I have a lottery file for a pick 5 or pick 6 game.

    I designed it for people that play a lot of tickets per draw.

    You can enter the numbers from up to 250 tickets (or groups of numbers).

    If you want to play 25 groups of numbers, unless you specifically ask for 25 individual tickets, they will give you 5 tickets with 5 groups of numbers on each ticket.

    It's an Excel 2002 file in the *.xls format. Want to see it?

  21. #21
    Forum Contributor
    Join Date
    10-21-2012
    Location
    miami, florida usa
    MS-Off Ver
    Excel 2007
    Posts
    260

    Re: LEN Function, Get rid of 0.333333 and replace by 0 (zeroe)

    Hi Mr Tony,

    Yes, i would like to see it.... what i'm doing is something similar, but all of this adding (root, doubles triples, etc,ect)
    are to filter out any tickets that don't match the Bell curve criteria..



    Thanks


    David

  22. #22
    Forum Contributor
    Join Date
    10-21-2012
    Location
    miami, florida usa
    MS-Off Ver
    Excel 2007
    Posts
    260

    Re: LEN Function, Get rid of 0.333333 and replace by 0 (zeroe)

    Hi Mr Tony,

    I can send you mine xls but where? is big, so i don't think i can post it here..
    (i believe the limit here is 2 or 3 Mb )


    Thanks


    David

  23. #23
    Forum Expert Tony Valko's Avatar
    Join Date
    12-31-2011
    Location
    Pittsburgh
    MS-Off Ver
    2002, 2007:2013
    Posts
    18,890

    Re: LEN Function, Get rid of 0.333333 and replace by 0 (zeroe)

    This file is just for checking to see if you have any winners.

    Ticket Checker.xls

    You'll have to enable macros. It has two macros, one for each sheet that simply clears the data that was entered. Click the Reset button.

    Enter the numbers that are drawn into the green cells at the top.

    Enter the numbers from your tickets. Type in a number then use the right arrow key to move to the next cell. After the last number is entered on a row and you use the right arrow key the active cell will automatically go to the next row.

    The sheets are protected but no password is needed to unprotect.

  24. #24
    Forum Expert Tony Valko's Avatar
    Join Date
    12-31-2011
    Location
    Pittsburgh
    MS-Off Ver
    2002, 2007:2013
    Posts
    18,890

    Re: LEN Function, Get rid of 0.333333 and replace by 0 (zeroe)

    Every now and then I'll get a lot of tickets.

    What I do is I write a number on the tickets 1, 2, 3, 4, 5, etc.

    Then, it's easy to find the ticket(s) that are winners. You'll see how the number rows are labeled.

  25. #25
    Forum Contributor
    Join Date
    10-21-2012
    Location
    miami, florida usa
    MS-Off Ver
    Excel 2007
    Posts
    260

    Re: LEN Function, Get rid of 0.333333 and replace by 0 (zeroe)

    Hi my friends!!

    Well, i found a Function that when find 0 or empty cell, it show the 0 (digit zero) as wanted,

    But now is the opposite :
    -.when find one (1) number (e.i 12, 01, or 35,) the function count as 2 digit ( i need to count as 1 number )
    -.when find two (2) numbers (e.i 12-13, 11-35, etc) the function count as 4 digit ( i need to count as 2 number )
    note: find with out the word "numbers"

    This is the function inserted :

    Please Login or Register  to view this content.
    Please any suggestion ??


    Best Regards

    David

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

    Re: LEN Function, Get rid of 0.333333 and replace by 0 (zeroe)

    '=if(a1&"-"="0-",0,len(a1&"-")-len(substitute(a1&"-","-","")))

  27. #27
    Forum Contributor
    Join Date
    10-21-2012
    Location
    miami, florida usa
    MS-Off Ver
    Excel 2007
    Posts
    260

    Re: LEN Function, Get rid of 0.333333 and replace by 0 (zeroe)

    Hi mr Martindwilson,

    when cell have no value, the Formula it recognize it at 1 (should be 0)
    When cell have 1, 2 or 3, it recognize it correct
    But in each cell it show the lil green dot (top left corner)

    Numbers ______Count
    Col__R12____l___S12___
    ____________l____1____ ---> no Ok,it should be 0 (because empty cell,no numbers found)
    ____________l____1____ ---> no Ok,it should be 0 (because empty cell,no numbers found)
    ____________l____1____ ---> no Ok,it should be 0 (because empty cell,no numbers found)
    ____35______l____1____ -> Ok
    ____36______l____1____ -> Ok
    ____19______l____1____ -> Ok
    ____23______l____1____ -> Ok
    ____35______l____1____ -> Ok
    ____28-35___l____2____ -> Ok
    __04-02-22__l____3____ -> Ok

    Best Regards

    David

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

    Re: LEN Function, Get rid of 0.333333 and replace by 0 (zeroe)

    well if its blank and not 0
    =IF(A1&"-"="-",0,LEN(A1&"-")-LEN(SUBSTITUTE(A1&"-","-","")))

  29. #29
    Forum Contributor
    Join Date
    10-21-2012
    Location
    miami, florida usa
    MS-Off Ver
    Excel 2007
    Posts
    260

    Re: LEN Function, Get rid of 0.333333 and replace by 0 (zeroe)

    Hi mr Martindwilson,

    Yes !!!!!!!!!!!!!!!!!!!!!!! It worked !!!!!

    Thank you sir, do you know that i have had 3 days searching the net for such problem
    and No one had a same problem before ( yes, because i could not find a solution, lol)

    Thank you Mr martin, Appreciated a Lot !!!!!

    Best regards

    David

+ 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] Need help with REPLACE function to replace HEX A0 with HEX 20 in string
    By flyboy54 in forum Excel Programming / VBA / Macros
    Replies: 7
    Last Post: 11-26-2013, 12:52 PM
  2. Replace function
    By jayron in forum Excel Programming / VBA / Macros
    Replies: 0
    Last Post: 02-27-2008, 01:50 PM
  3. replace function
    By andrewm in forum Excel Formulas & Functions
    Replies: 1
    Last Post: 04-25-2007, 03:22 AM
  4. Replace Function:Replace" and type in
    By ronnyc in forum Excel Formulas & Functions
    Replies: 3
    Last Post: 03-19-2007, 06:26 PM
  5. Need Help with Replace Function
    By buymearing in forum Excel Formulas & Functions
    Replies: 4
    Last Post: 11-02-2005, 09:39 AM

Tags for this Thread

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