Consulting

Results 1 to 5 of 5

Thread: SUMPRODUCT and LEFT(LEN())

  1. #1
    VBAX Mentor Sir Babydum GBE's Avatar
    Joined
    Mar 2005
    Location
    Cardiff, UK
    Posts
    499
    Location

    SUMPRODUCT and LEFT(LEN())

    Hi

    This is a formula one more than VBA...

    In the attached, I need to try and get Babydum's results to include the various ways Babydum appears in the list. In reality, if there were only two possibilities it would be easy, but on a real list there are many names and some have three or four suffixes - so I tried using Left(len but I couldn't get it to work.

    Any ideas?

    Cheers

    BD
    Have a profound problem? Need a ridiculous solution? Post a question in Babydum's forum

  2. #2
    Distinguished Lord of VBAX VBAX Grand Master Bob Phillips's Avatar
    Joined
    Apr 2005
    Posts
    25,453
    Location
    =SUMPRODUCT(--(ISNUMBER(SEARCH($G5,$B$3:$B$29))),--(H$4=$C$3:$C$29)*($D$3:$D$29))
    ____________________________________________
    Nihil simul inventum est et perfectum

    Abusus non tollit usum

    Last night I dreamed of a small consolation enjoyed only by the blind: Nobody knows the trouble I've not seen!
    James Thurber

  3. #3
    VBAX Mentor Sir Babydum GBE's Avatar
    Joined
    Mar 2005
    Location
    Cardiff, UK
    Posts
    499
    Location
    Quote Originally Posted by xld
    =SUMPRODUCT(--(ISNUMBER(SEARCH($G5,$B$3:$B$29))),--(H$4=$C$3:$C$29)*($D$3:$D$29))
    Excellent! Incidentally - what's ISNUMBER doing there?
    Have a profound problem? Need a ridiculous solution? Post a question in Babydum's forum

  4. #4
    Distinguished Lord of VBAX VBAX Grand Master Bob Phillips's Avatar
    Joined
    Apr 2005
    Posts
    25,453
    Location
    Oh, I just chucked it in for a bit of sport.

    Because it doesn't work without it.

    And now for a reasonable answer.

    The Search is looking through the range for the value in G5. Search will find that string anywhere in the lookup value, and return the character index if it finds it. If it doesn't find it, it returns #N/A. So the ISNUMBER is used to check each return value to be a number or an error, and return a TRUE/FALSE, which as you know SP gobbles up for breakfast.
    ____________________________________________
    Nihil simul inventum est et perfectum

    Abusus non tollit usum

    Last night I dreamed of a small consolation enjoyed only by the blind: Nobody knows the trouble I've not seen!
    James Thurber

  5. #5
    VBAX Mentor Sir Babydum GBE's Avatar
    Joined
    Mar 2005
    Location
    Cardiff, UK
    Posts
    499
    Location
    Well it's thoroughly geniousy.

    BD
    Have a profound problem? Need a ridiculous solution? Post a question in Babydum's forum

Posting Permissions

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