+ Reply to Thread
Results 1 to 12 of 12

SUMPRODUCT+INDIRECT error

  1. #1
    Registered User
    Join Date
    05-28-2008
    Posts
    5

    SUMPRODUCT+INDIRECT error

    Hi,
    I'm pretty new to Excel and just got stuck on a problem.
    I have a formula that gets a part number from a cell and then adds some values from multiple records with the same part number on an another sheet. Works perfectly if I use a direct reference:
    =SUMPRODUCT((StykerWIP!A$2:A$563=$B$3)*(StykerWIP!C$2:C$563))
    __________________________________^^^
    But if I try to use INDIRECT I get a #VALUE error:
    =SUMPRODUCT((StykerWIP!A$2:A$563=INDIRECT("B"&(ROW()))*(StykerWIP!C$2:C$563)))

    The part number is text - "6939-1-430" - and when I use INDIRECT separately it returns the value just fine.
    =INDIRECT("B"&(ROW()))

    What am I doing wrong?

    TIA,
    Bart

  2. #2
    Forum Contributor
    Join Date
    01-05-2004
    Location
    Helsinki, Finland
    Posts
    100
    Hi,

    The reason for the error is that ROW() returns an array and it cannot be connected with a string ("B"). I think it is so because it's inside the SUMPRODUCT function. Take the first part of the array with INDEX() function and it should work. Like this:

    Please Login or Register  to view this content.
    - Asser

  3. #3
    Registered User
    Join Date
    05-28-2008
    Posts
    5
    Doesn't work, still the same error...
    Attached Files Attached Files

  4. #4
    Forum Expert
    Join Date
    12-23-2006
    Location
    germany
    MS-Off Ver
    XL2003 / 2007 / 2010
    Posts
    6,326
    Quote Originally Posted by aberrator2000
    Doesn't work, still the same error...
    In which cell do you get an error?
    Why use the INDIRECT function?
    If you want to pull the formula down to adapt, juste use =$b3
    Last edited by arthurbr; 05-28-2008 at 07:08 AM.

  5. #5
    Registered User
    Join Date
    05-28-2008
    Posts
    5
    I had some problems with bad values when I sorted the data using relative references, but they seem to be gone now, must've been something else. Works perfecly now.
    Sheesh.

    Still I'm curious why indirect doesn't work...
    I get errors in all the cells in the L-K range.

  6. #6
    Forum Contributor EdMac's Avatar
    Join Date
    01-23-2006
    Location
    Exeter, UK
    MS-Off Ver
    2003
    Posts
    1,264
    Is the other workbook closed? Indirect only works on open workbooks.
    Ed
    _____________________________
    Always learning, but never enough!
    _____________________________

  7. #7
    Forum Expert NBVC's Avatar
    Join Date
    12-06-2006
    Location
    Mississauga, CANADA
    MS-Off Ver
    2003:2010
    Posts
    34,898
    Quote Originally Posted by aberrator2000
    I had some problems with bad values when I sorted the data using relative references, but they seem to be gone now, must've been something else. Works perfecly now.
    Sheesh.

    Still I'm curious why indirect doesn't work...
    I get errors in all the cells in the L-K range.
    Indirect() is used when your are indirectly referencing a cell...not directly referencing a cell..

    Read Excel help files on INDIRECT function.... there are some examples there that might help you to understand how it works.
    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
    Registered User
    Join Date
    05-28-2008
    Posts
    5
    Both sheets are in the same workbook.

    And reading help didn't really help (hmm) because according to it indirect simply returns the cell value, so when comparing it to another value it should work, as it does with SUM or anything else.

  9. #9
    Forum Expert NBVC's Avatar
    Join Date
    12-06-2006
    Location
    Mississauga, CANADA
    MS-Off Ver
    2003:2010
    Posts
    34,898
    The item in the cell you indirectly refer to must be a reference to another place...via a cell reference, named range/reference or sheetname..

    e.g. in B2 you would have to have something like "Sheet2!B2"

  10. #10
    Forum Expert
    Join Date
    12-23-2006
    Location
    germany
    MS-Off Ver
    XL2003 / 2007 / 2010
    Posts
    6,326
    As NBVC explained, INIDRECT references another cell.
    If in a1 you have " hello", in a2 you have "a1", INDIRECT(A2)="hello", not a1

  11. #11
    Registered User
    Join Date
    05-28-2008
    Posts
    5
    That's exactly what I'm talking about!
    A1 has the value of "6940-1-480"
    when I put '=INDIRECT("A1")' into B1 the result IS 6940-1-480
    Same when I put =INDIRECT("A"&ROW())

    So it doesn't really have to be a reference, can be just a value too, and thus sumproduct should work, just as sum and other functions work.
    I just don't get it.

  12. #12
    Registered User
    Join Date
    02-15-2013
    Location
    Earth
    MS-Off Ver
    Excel 2003
    Posts
    1

    Re: SUMPRODUCT+INDIRECT error

    Quote Originally Posted by Jazzer View Post
    Hi,

    The reason for the error is that ROW() returns an array and it cannot be connected with a string ("B"). I think it is so because it's inside the SUMPRODUCT function. Take the first part of the array with INDEX() function and it should work. Like this:

    Please Login or Register  to view this content.
    - Asser

    This solved the problem I was having... thanks Asser!

+ 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