Consulting

Results 1 to 5 of 5

Thread: Solved: Formula question for extracting numbers

  1. #1
    Moderator VBAX Wizard lucas's Avatar
    Joined
    Jun 2004
    Location
    Tulsa, Oklahoma
    Posts
    7,323
    Location

    Solved: Formula question for extracting numbers

    I"m trying to extract a number after a /
    the number I'm trying to extract from looks like this: 940 VA / 3860 VA

    and the following formula works nicely:

    =--MID(A1,FIND("/",A1)+2,4)

    Which returns 3860

    I have encountered a problem with some new numbers that look like the following examples which don't have 4 digits after the slash and space and returns an error:
    830 VA / 80 VA
    from which I would like to see the number 80 returned
    or
    940 VA / 0 VA
    from which I would like to see the number 0 returned

    I have tried several things but can't find an easy way to do this.

    I have attached a simple spreadsheet example. The formula's are in column B.

    Anyone suggest a direction for accomplishing this using a formula?
    Steve
    "Nearly all men can stand adversity, but if you want to test a man's character, give him power."
    -Abraham Lincoln

  2. #2
    VBAX Mentor tpoynton's Avatar
    Joined
    Feb 2005
    Location
    Clinton, MA
    Posts
    399
    Location
    =--MID(A1,FIND("/",A1)+2,LEN(A1)-FIND("/",A1)-3) ?

  3. #3
    Moderator VBAX Wizard lucas's Avatar
    Joined
    Jun 2004
    Location
    Tulsa, Oklahoma
    Posts
    7,323
    Location
    Thank you very much tpoynton. That works just fine.

    If I understand this the 3 makes this work on anything up to 4 digits, is that correct?
    Steve
    "Nearly all men can stand adversity, but if you want to test a man's character, give him power."
    -Abraham Lincoln

  4. #4
    VBAX Mentor tpoynton's Avatar
    Joined
    Feb 2005
    Location
    Clinton, MA
    Posts
    399
    Location
    the -3 is to address the space and VA, so it should work on any # of digits...not tested for that though!

  5. #5
    Moderator VBAX Wizard lucas's Avatar
    Joined
    Jun 2004
    Location
    Tulsa, Oklahoma
    Posts
    7,323
    Location
    That makes perfect sense. Thank you very much tpoynton.
    Steve
    "Nearly all men can stand adversity, but if you want to test a man's character, give him power."
    -Abraham Lincoln

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •