+ Reply to Thread
Results 1 to 13 of 13

How can i shorten up this function / formula?

  1. #1
    Registered User
    Join Date
    10-16-2008
    Location
    blahblahblah
    Posts
    19

    How can i shorten up this function / formula?

    Just wondering if there is a way to shorten this up? I need to add some more conditions, but if i do that, it's going to get really really really long...

    SUMPRODUCT(--($B$2:$B$525=A4001)*(($E$2:$E$525="Local Loop")+($E$2:$E$525="Long Haul")+($E$2:$E$525="Loop A")+($E$2:$E$525="loop z")),--(($M$2:$M$525="live")+($M$2:$M$525="Pending - Cancellation")),$BX$2:$BX$525)

    Also, is there anyway to extend the range of what i'm searching for? The formula i have above isn't entirely correct b/c if I go to 525, it comes up with n/a. If i have it at 346, i get a result.

  2. #2
    Forum Expert Ron Coderre's Avatar
    Join Date
    03-22-2005
    Location
    Boston, Massachusetts
    MS-Off Ver
    2013, 2016, O365
    Posts
    6,996

    How can i shorten up this function / formula?

    Try this:
    Please Login or Register  to view this content.
    Does that help?
    Ron
    Former Microsoft MVP - Excel (2006 - 2015)
    Click here to see the Forum Rules

  3. #3
    Registered User
    Join Date
    10-16-2008
    Location
    blahblahblah
    Posts
    19
    i'll definitely have to try that, thank you

  4. #4
    Forum Expert Ron Coderre's Avatar
    Join Date
    03-22-2005
    Location
    Boston, Massachusetts
    MS-Off Ver
    2013, 2016, O365
    Posts
    6,996

    How can i shorten up this function / formula?

    This shorter formula also works:
    Please Login or Register  to view this content.
    Note: You could also put the list options in cell ranges and refer to them...
    Example:
    With
    A3:A6 containing this list
    Please Login or Register  to view this content.
    and
    A8:A9 containing this list
    Please Login or Register  to view this content.
    Use this formula:
    Please Login or Register  to view this content.
    Does that help?

  5. #5
    Registered User
    Join Date
    10-16-2008
    Location
    blahblahblah
    Posts
    19
    With the original suggestion, I only get a value of zero, even when I had values of higher numbers with the original long formula version.

    I tried to edit the formula you suggested by removing the ,0 from the end of each match statement, but that did not change anything.

    However, I am DEFINITELY going to pursue the second option you gave me with the list That will make everything so much easier.

  6. #6
    Registered User
    Join Date
    10-16-2008
    Location
    blahblahblah
    Posts
    19
    I keep getting value errors when trying to use a table to look up the comparable values. If I don't get a value error, then I end up getting a result of 0.

    Please Login or Register  to view this content.
    If i use my old formula, I can get it to work, but it is lengthy and not as clean as what you suggested.

    Please Login or Register  to view this content.
    I've put a table on here as well so you can see what I am doing.

    (ignore the circular error..i was just trying something out at the bottom) !!
    Attached Files Attached Files

  7. #7
    Forum Expert NBVC's Avatar
    Join Date
    12-06-2006
    Location
    Mississauga, CANADA
    MS-Off Ver
    2003:2010
    Posts
    34,898
    Looking at your formula, it looks like you forgot to include the 3rd argument in your Match() functions. Ie. the last 0 is missing.
    Where there is a will there are many ways.

    If you are happy with the results, please add to the contributor's reputation by clicking the reputation icon (star icon) below left corner

    Please also mark the thread as Solved once it is solved. Check the FAQ's to see how.

  8. #8
    Forum Expert Ron Coderre's Avatar
    Join Date
    03-22-2005
    Location
    Boston, Massachusetts
    MS-Off Ver
    2013, 2016, O365
    Posts
    6,996

    How can i shorten up this function / formula?

    Here you go....
    There were two issues:
    1) The 3rd argument (,0) in the MATCH functions is necessary
    2) The ISNUMBER function should only apply to the MATCH section.

    Try this...
    Please Login or Register  to view this content.
    Copy that formula down through F53

    Does that help?

  9. #9
    Registered User
    Join Date
    10-16-2008
    Location
    blahblahblah
    Posts
    19

    Lightbulb

    Thanks again Ron, your help has been tremendous. I can get the formula to work as you provided it, for the small sample I attached.

    However, when I move the formula to a spot deep within my actual spreadsheet, I only receive a "0" value for the data. The changed formula I'm using is below. I compared it to what you provided, and it is identical other than the ranges of where to look up the values.

    Any ideas why I would only get 0's as a result?

    Please Login or Register  to view this content.
    Please Login or Register  to view this content.

  10. #10
    Registered User
    Join Date
    10-16-2008
    Location
    blahblahblah
    Posts
    19
    Here is a trimmed down version of the real spreadsheet I am using.

    I put the formula and data tables starting in cell DA3879, which should be pointing back to the raw data I have at the top left section of the spreadsheet.

    For some reason, when I have it seperated out like this, I only get 0's for results instead of the true values. As I mentioned before, on the small sample spreadsheet, I could get the original formula you helped me with to work.

    Thanks again for all of your help. These forums have proven to be an invaluable resource!
    Attached Files Attached Files

  11. #11
    Forum Expert Ron Coderre's Avatar
    Join Date
    03-22-2005
    Location
    Boston, Massachusetts
    MS-Off Ver
    2013, 2016, O365
    Posts
    6,996

    How can i shorten up this function / formula?

    There are a couple issue with your formula

    1) The 2nd MATCH function should compare the Col_M data
    to the lookup list.

    2) The lookup reference in the MATCH functions should refer to ranges that
    contain only the lookup list and not the blank cells beneath them.

    Try this
    Please Login or Register  to view this content.
    Copy that formula down as far as you need.

    Does that help?

  12. #12
    Registered User
    Join Date
    10-16-2008
    Location
    blahblahblah
    Posts
    19
    I love you Simple mistakes on my part that for some reason I couldn't find...even after staring at it for hours and hours. You can consider this topic resolved!!

    Thanks again for your help.

  13. #13
    Forum Expert Ron Coderre's Avatar
    Join Date
    03-22-2005
    Location
    Boston, Massachusetts
    MS-Off Ver
    2013, 2016, O365
    Posts
    6,996

    How can i shorten up this function / formula?

    You're very welcome. I'm so glad I could help.

+ 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. Multi Nested function formula Error
    By Cullihall in forum Excel Formulas & Functions
    Replies: 2
    Last Post: 09-18-2008, 10:39 AM
  2. How do I subsitute part of a formula linked to another workbook?
    By Scej12 in forum Excel Formulas & Functions
    Replies: 11
    Last Post: 08-03-2007, 10:10 AM
  3. Custom formula in Subtotal function??
    By anthonyjf in forum Excel General
    Replies: 7
    Last Post: 08-03-2007, 10:06 AM
  4. Insert a number into a function formula
    By accur8ly in forum Excel Formulas & Functions
    Replies: 3
    Last Post: 08-01-2007, 11:47 AM
  5. Over Rule - Formula Function!
    By ianternet in forum Excel Formulas & Functions
    Replies: 2
    Last Post: 12-11-2006, 05:04 PM

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