+ Reply to Thread
Results 1 to 8 of 8

Multiple IF(ISNUMBER(SEARCH...), need sum

  1. #1
    Registered User
    Join Date
    02-10-2014
    Location
    United States
    MS-Off Ver
    Excel 2013
    Posts
    7

    Multiple IF(ISNUMBER(SEARCH...), need sum

    Hi - this is my first post into this forum & I'm hoping you all can help.

    I'm trying to consolidate a formula with a lot of =IF(ISNUMBER(SEARCH...) components. It's probably best if I show my example.

    If I'm creating a product bundle where each piece has a different price, I want the formula to add the prices depending on which products I choose to include in the bundle.

    Column A is the product number.
    Column B is the price.

    For the example, cell B9, is the bundle I'm creating with 2 or more of the products.

    Right now I can get the answer I need with =IF(ISNUMBER(SEARCH($A$2, B9)), $B$2,0)+IF(ISNUMBER(SEARCH($A$3, B9)), $B$3,0)+IF(ISNUMBER(SEARCH($A$4, B9)), $B$4,0)+IF(ISNUMBER(SEARCH($A$5, B9)), $B$5,0)+IF(ISNUMBER(SEARCH($A$6, B9)), $B$6,0), but this will be super time consuming to make if I have 20 products in a potential bundle.

    Please see attached for specific spreadsheet.

    Thank you!
    Attached Files Attached Files

  2. #2
    Forum Guru benishiryo's Avatar
    Join Date
    03-25-2011
    Location
    Singapore
    MS-Off Ver
    Excel 2013
    Posts
    5,147

    Re: Multiple IF(ISNUMBER(SEARCH...), need sum

    welcome to the forum. try this array formula in D9:
    =SUM(SUMIF($A$2:$A$6,IF(ISNUMBER(SEARCH(" "&$A$2:$A$6&","," "&B9&",")),$A$2:$A$6),$B$2:$B$6))

    ...confirmed by pressing CTRL+SHIFT+ENTER to activate the array, not just ENTER. You will know the array is active when you see curly braces { } appear around your formula. If you do not CTRL+SHIFT+ENTER you will get an error or a clearly incorrect answer. Press F2 on that cell and try again.

    Thanks, if you have clicked on the * and added our rep.

    If you're satisfied with the answer, click Thread Tools above your first post, select "Mark your thread as Solved".

    "Contentment is not the fulfillment of what you want, but the realization of what you already have."


    Tips & Tutorials I Compiled | How to Get Quick & Good Answers

  3. #3
    Forum Expert martindwilson's Avatar
    Join Date
    06-23-2007
    Location
    London,England
    MS-Off Ver
    office 97 ,2007
    Posts
    19,320

    Re: Multiple IF(ISNUMBER(SEARCH...), need sum

    =SUMPRODUCT(ISNUMBER(SEARCH($A$2:$A$6,B10))*($B$2:$B$6)) seems to work
    "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

  4. #4
    Forum Guru benishiryo's Avatar
    Join Date
    03-25-2011
    Location
    Singapore
    MS-Off Ver
    Excel 2013
    Posts
    5,147

    Re: Multiple IF(ISNUMBER(SEARCH...), need sum

    @martin:
    i may be assuming wrongly, but i think OP simplified things as for the Product code. in reality, it may have more than 1 single alphabet. A6 might be BA. B9 might be B, BA

  5. #5
    Forum Expert martindwilson's Avatar
    Join Date
    06-23-2007
    Location
    London,England
    MS-Off Ver
    office 97 ,2007
    Posts
    19,320

    Re: Multiple IF(ISNUMBER(SEARCH...), need sum

    =sumproduct(isnumber(search(" "&$a$2:$a$6&" "," "&substitute(b9,","," ")&" "))*($b$2:$b$6))

  6. #6
    Registered User
    Join Date
    02-10-2014
    Location
    United States
    MS-Off Ver
    Excel 2013
    Posts
    7

    Re: Multiple IF(ISNUMBER(SEARCH...), need sum

    @Benishiryo - THANK YOU! This worked and definitely accounts for the longer product numbers like you assumed. I really appreciate your help.

  7. #7
    Registered User
    Join Date
    02-10-2014
    Location
    United States
    MS-Off Ver
    Excel 2013
    Posts
    7

    Re: Multiple IF(ISNUMBER(SEARCH...), need sum

    Quick follow up question - is there a way for it to count a value twice - what if I want a bundle with 2 of A & 1 of B, then I'd type in A, A, B in the B9 cell, but it only counts A once currently.

  8. #8
    Forum Guru benishiryo's Avatar
    Join Date
    03-25-2011
    Location
    Singapore
    MS-Off Ver
    Excel 2013
    Posts
    5,147

    Re: Multiple IF(ISNUMBER(SEARCH...), need sum

    you're very welcome. the solution martin amended in post #5 would work too.

    for your new requirement, probably:
    =SUMPRODUCT(SUMIF($A$2:$A$6,TRIM(MID(SUBSTITUTE(B9,", ",REPT(" ",LEN(B9))),(ROW($1:$101)-1)*LEN(B9)+1,LEN(B9))),$B$2:$B$6))
    don't have to press CTRL + SHIFT + ENTER this time.

    do mark it as Solved if that does it. thanks

  9. #9
    Registered User
    Join Date
    02-10-2014
    Location
    United States
    MS-Off Ver
    Excel 2013
    Posts
    7

    Re: Multiple IF(ISNUMBER(SEARCH...), need sum

    Thanks again @Benishiryo. I don't know how you figure this out, but I'm amazed & very grateful.

+ Reply to Thread

Thread Information

Users Browsing this Thread

There are currently 1 users browsing this thread. (0 members and 1 guests)

Similar Threads

  1. Combined IF ISNUMBER SEARCH for multiple words
    By caffegelato in forum Excel Formulas & Functions
    Replies: 9
    Last Post: 05-16-2013, 08:57 AM
  2. Help with multiple If(Isnumber(Search( function
    By khk410 in forum Excel Formulas & Functions
    Replies: 4
    Last Post: 03-27-2013, 09:07 AM
  3. [SOLVED] how to have multiple ISNUMBER search function in SUMPRODUCT
    By melvyndb in forum Excel Programming / VBA / Macros
    Replies: 5
    Last Post: 04-29-2012, 09:34 PM
  4. Multiple ISNUMBER(SEARCH()) functions
    By Bassteban in forum Excel General
    Replies: 1
    Last Post: 08-17-2011, 01:55 PM
  5. Multiple IF ISNUMBER SEARCH
    By bibach in forum Excel General
    Replies: 5
    Last Post: 07-13-2011, 04:41 AM

Tags for this Thread

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