+ Reply to Thread
Results 1 to 4 of 4

Num_chars return characters vary from cell to cell

  1. #1
    Registered User
    Join Date
    04-04-2013
    Location
    Iron Mountain, MI
    MS-Off Ver
    Excel 2010
    Posts
    14

    Num_chars return characters vary from cell to cell

    In the mid function, is there something special to use in the Num_chars field when the characters to be returned will vary? In the examples below, I want everything after the space dash space, so character 14. But the number to return after that will be different from cell to cell. I just keep using a number that I know is big enough, but am just wondering if there is a better way.

    =MID(D20,14,50) 12345678901 -ab cde fg hi
    =MID(D21,14,50) 23456789012 -jklm nop qrstu vwx yz

    Thanks!
    Attached Images Attached Images

  2. #2
    Forum Expert Ace_XL's Avatar
    Join Date
    06-04-2012
    Location
    UAE
    MS-Off Ver
    2016
    Posts
    6,074

    Re: Num_chars return characters vary from cell to cell

    Why not use..

    =RIGHT(D20,LEN(D20)-FIND("-",D20))
    Life's a spreadsheet, Excel!
    Say thanks, Click *

  3. #3
    Forum Guru Jonmo1's Avatar
    Join Date
    03-08-2013
    Location
    Bryan, TX
    MS-Off Ver
    Excel 2010
    Posts
    9,763

    Re: Num_chars return characters vary from cell to cell

    It's OK for that num_chars argument to be larger than it needs to be, provided your intention is to return ALL text after the certain starting point.

    But instead of having to guess at a number that is large enough, you can use the LEN function
    =MID(D20,14,LEN(D20))

    If you wanted to be precise and get the absolute correct # you could then subtract the 14 from the LEN
    =MID(D20,14,LEN(D20)-14) <- but completely unnecessary to do that.

  4. #4
    Registered User
    Join Date
    04-04-2013
    Location
    Iron Mountain, MI
    MS-Off Ver
    Excel 2010
    Posts
    14

    Re: Num_chars return characters vary from cell to cell

    Thank you both for your response. I'm showing some co-workers a few basic functions and was trying to keep it simple for them. But I will try both suggestions on my own spreadsheets.

+ 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