+ Reply to Thread
Results 1 to 7 of 7

LEN Function, count number of Numbers in a cell, but count if are 12 numbers the most..

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

    Unhappy LEN Function, count number of Numbers in a cell, but count if are 12 numbers the most..

    Hi,

    Merry Christmas !!!

    please i need some help on =LEN function

    On daily basis I Have a groups of Numbers On Cell G4 to G109

    FOR EXAMPLE

    On Cell H4 I input the len function as =LEN(G4)

    And this function count each Digit plus the character "-"

    EXAMPLE what im getting (i don't want this)

    IncorrectLEN.png


    What i need is to count just the Numbers, not the character "-"


    Also i tryed others LEN Functions and didn't work for me

    e.i

    =LEN(G4)-LEN(SUBSTITUTE(G4,",",""))+1



    Example what i do need (desired output)

    DesireOutput.png




    Thanks

    David

    Best Regards from Miami.

  2. #2
    Forum Expert Moo the Dog's Avatar
    Join Date
    09-28-2012
    Location
    Wisconsin
    MS-Off Ver
    Office 365 (PC & Mac)
    Posts
    1,845

    Re: LEN Function, count number of Numbers in a cell, but count if are 12 numbers the most.

    Try this:

    =(LEN(G4)+1)/3

    - Moo

  3. #3
    Forum Moderator - RIP Richard Buttrey's Avatar
    Join Date
    01-14-2008
    Location
    Stockton Heath, Cheshire, UK
    MS-Off Ver
    Office 365, Excel for Windows 2010 & Excel for Mac
    Posts
    29,464

    Re: LEN Function, count number of Numbers in a cell, but count if are 12 numbers the most.

    And the seasons greetings to you too.

    If the numbers are always in pairs then

    =LEN(SUBSTITUTE(A1,"-",""))/2
    Richard Buttrey

    RIP - d. 06/10/2022

    If any of the responses have helped then please consider rating them by clicking the small star icon below the post.

  4. #4
    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, count number of Numbers in a cell, but count if are 12 numbers the most.

    =if(g4="","",len(g4)-len(substitute(g4,"-",""))+1)
    "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

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

    Re: LEN Function, count number of Numbers in a cell, but count if are 12 numbers the most.

    Hi Mr Moo,

    Yes it work as i need !!

    Thanks !!!

    p.s
    Wow, the ")/3" .... give me a hard time... ji ji ji


  6. #6
    Registered User
    Join Date
    12-22-2012
    Location
    Richmond, NSW, Australia
    MS-Off Ver
    Excel 2003 Excel 2007 Excel 2010 Excel 2013
    Posts
    13

    Re: LEN Function, count number of Numbers in a cell, but count if are 12 numbers the most.

    Hi David!

    From your data both bad and good:

    Logic is that despite you not wanting to count the "-", you'll get the number of your numbers using:

    =LEN(G4)-LEN(SUBSTITUTE(G4,"-",""))+1

    Seems to work OK on your data.

    Hope that helps more than it confuses.

    Norman Harker

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

    Re: LEN Function, count number of Numbers in a cell, but count if are 12 numbers the most.

    Hi, !!

    Wow, i trying since this morning i'm trying to solve the LEN thinghi, and let me tell you guys

    all of the Formulas you posted work!!

    Thank you all !!! Richard, Marting, Norman .....

+ 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