+ Reply to Thread
Results 1 to 10 of 10

Problem with lookup formula - missing values

  1. #1
    Registered User
    Join Date
    07-17-2009
    Location
    Bristol England
    MS-Off Ver
    Excel 2007
    Posts
    46

    Problem with lookup formula - missing values

    Hi, I have previously had some help extracting some numbers from a sentence, but have come across a few problems. The formula works well 50% of the time, but randomly skips over some values. I have attached a sample of what I'm working on.

    Extracting example.xlsx

    There will be thousands of questions similar, but think there will be a limit of 4 numbers to be taken out.

    Thanks in advance

    Georgette
    Last edited by Geomarsh; 08-12-2009 at 10:51 AM.

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

    Re: Problem with lookup formula - missing values

    In your SUBSTITUTE functions you need to ensure that you use the values found previously to 2 decimals given this is how they are listed in your string, eg:

    B1 is 2.1 as a value but in your string it is "2.10" - you need to format therefore format 2.1 (b1) to 2 decimals such that the "2.10" is removed else removing 2.1 leaves "0" which is why it is the next found number... so revise per below:

    Please Login or Register  to view this content.

  3. #3
    Registered User
    Join Date
    07-17-2009
    Location
    Bristol England
    MS-Off Ver
    Excel 2007
    Posts
    46

    Re: Problem with lookup formula - missing values

    AHHH - knew it would be something like formatting as come across trouble with currency format before!!

    Thanks!

  4. #4
    Registered User
    Join Date
    07-17-2009
    Location
    Bristol England
    MS-Off Ver
    Excel 2007
    Posts
    46

    Re: Problem with lookup formula - missing values

    may have prematurely solved that post, as have moved on to different examples, and it is now only outputting the first value 3 times?

    Extracting example2.xlsx

    Sorry I'm so appalling at this!

    Thanks

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

    Re: Problem with lookup formula - missing values

    You're not appalling, what you're doing is relatively complex - the reason you're now getting the results you are is that the quantity is being found first ... I have to say I saw your first thread on this and NBVC's approach utilising Regular Expressions (c/o Laurent Longre's morefunc.xll) is I think best suited to this type of task (my opinion), eg:

    B1: =REGEX.MID(A1,"(£[0-9]+\.[0-9]{2})")
    copied down

    You can still do what you're doing using native functions but they will become pretty complicated ... problem with Reg Exp is that they're not exactly intuitive.

  6. #6
    Registered User
    Join Date
    07-17-2009
    Location
    Bristol England
    MS-Off Ver
    Excel 2007
    Posts
    46

    Re: Problem with lookup formula - missing values

    Haha, ok, I'll have to download that extra function at home and have a go, and hopefully have success!!

    Thanks very much DO,

    Georgette

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

    Re: Problem with lookup formula - missing values

    No problem.

    FYI: in terms of the original approach - it becomes something like:

    Please Login or Register  to view this content.
    etc but as you can see things will get increasingly messy...

  8. #8
    Registered User
    Join Date
    07-17-2009
    Location
    Bristol England
    MS-Off Ver
    Excel 2007
    Posts
    46

    Re: Problem with lookup formula - missing values

    Think I've had a breakthrough in my understanding of this all. I only have to do the TEXT function for values that will be in the format ??/?? or similar. Interger values i can use the original SUBSTITUTE function!!

    Wooo!

    Thanks

  9. #9
    Registered User
    Join Date
    07-17-2009
    Location
    Bristol England
    MS-Off Ver
    Excel 2007
    Posts
    46

    Re: Problem with lookup formula - missing values

    Just seen the last post, Can agree it may get quite confusing! Will carry on with LOOKUPs for now, have a play with the regex when I get home!

    Thanks

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

    Re: Problem with lookup formula - missing values

    Quote Originally Posted by Geomarsh View Post
    Think I've had a breakthrough in my understanding of this all. I only have to do the TEXT function for values that will be in the format ??/?? or similar. Interger values i can use the original SUBSTITUTE function!!
    Yes, in reality there are no numbers per se in A1 given it is in fact a text string ... think of it like:

    =SUBSTITUTE("I have apples","apple","") --> "I have s"

    =SUBSTITUTE("I have £2.10","2.1","") --> "I have £0"

    ie "£2.10" is treated no differently to "apples" given they are both text strings in this context, "2.1" <> "2.10" as "apple" <> "apples".

+ 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