+ Reply to Thread
Results 1 to 20 of 20

Using sumproduct gives 0 when using indirect directly in the formula

  1. #1
    Registered User
    Join Date
    11-21-2018
    Location
    Belgium
    MS-Off Ver
    2013
    Posts
    9

    Using sumproduct gives 0 when using indirect directly in the formula

    Hello!

    So the problem is quite easy:
    If I use =SUMPRODUCT(INDIRECT(Cell1);INDIRECT(Cell2)) I get 15 as a result (which is the value I want).
    Cell1: T9:Y9
    Cell2: T6:Y6

    However, when I calculate the cell references using either adres or substitute or ... directly in the sumproduct formula, I get as a result: 0.
    Why is this? (If required to see the full formula, just ask ^^ since I guess that this has not really something to do with the formula itself but the way Excel behaves).

    I really don't like to use extra cells for cell references since so far they always worked fine (e.g. sum(indirect(...)).

    Thanks in advance

    Ps: I would to know why this formula behaves like this, I would also like to have a solution (e.g. a formula that does what I want but without extra cell references like I have to do now with Cell1 and Cell2).
    Last edited by BrentViata; 11-21-2018 at 04:41 PM.

  2. #2
    Forum Moderator Glenn Kennedy's Avatar
    Join Date
    07-08-2012
    Location
    Digital Nomad... occasionally based in Ireland.
    MS-Off Ver
    O365 (PC) V 2406
    Posts
    44,662

    Re: Using sumproduct gives 0 when using indirect directly in the formula

    Will you please attach a SMALL sample Excel workbook (10-20 rows of data is usually enough)? However, please give us an indication of the approximate number of rows of data you want the solution to work with (100, 1000, 100,000 or whatever). Please don't attach a picture of an Excel sheet (no-one will want to re-type all your stuff before starting).

    1. Make sure that your sample data are truly REPRESENTATIVE of your real data. The use of unrepresentative data is very frustrating and can lead to long delays in reaching a solution.

    2. Make sure that your desired solution is also shown (mock up the results manually).

    3. Make sure that all confidential information is removed first!!

    4. Try to avoid using merged cells. They cause lots of problems!

    Unfortunately the attachment icon doesn't work at the moment. So, to attach an Excel file you have to do the following: Just before posting, scroll down to Go Advanced and then scroll down to Manage Attachments. Now follow the instructions at the top of that screen.
    Glenn




    None of us get paid for helping you... we do this for fun. So DON'T FORGET to say "Thank You" to all who have freely given some of their time to help YOU

  3. #3
    Registered User
    Join Date
    11-21-2018
    Location
    Belgium
    MS-Off Ver
    2013
    Posts
    9

    Re: Using sumproduct gives 0 when using indirect directly in the formula

    Hello

    Ofcourse!
    Data starts in A7 but unfortunately is formatted wrongly so there is a bunch of correcting those data values.
    The real data I want to use starts in cell Q7. One array is always based on row 6 (but the number of elements can change) and the other array in the sumproduct formula changes every row ofcourse.
    I expect that this should be enough data :D

    Everything is as asked:
    1. Done
    2. Done: column Y is the perfect example of what I want but without using columns W and X
    3. Done
    4. Not using them anyway ^^
    Attached Files Attached Files

  4. #4
    Forum Moderator Glenn Kennedy's Avatar
    Join Date
    07-08-2012
    Location
    Digital Nomad... occasionally based in Ireland.
    MS-Off Ver
    O365 (PC) V 2406
    Posts
    44,662

    Re: Using sumproduct gives 0 when using indirect directly in the formula

    You're making life VERY difficult for yourself. Forget Excel. Mathematically, you are reversing the order of your datapoints (why??) and removing outliers. You are then doing some sums on what's left. EXACTLY what are the calculations? maths, not Excel, please...

  5. #5
    Registered User
    Join Date
    11-21-2018
    Location
    Belgium
    MS-Off Ver
    2013
    Posts
    9

    Re: Using sumproduct gives 0 when using indirect directly in the formula

    Hi Glenn!

    Thank you for your reply.
    Honestly, I don't think that it is none of your concern what I am doing in the Excel file regarding mathematics. This also implies that you don't know what I am doing and what I want to achieve, which is again, not important for you.
    This is not a matter of mathematics. I know which elements I have to multiply, divide, sum ... to get where I want. What I don't know is exactly that which I posted initially and which is 100 % Excel related.

    I hope that you are able to see past all those things and actually focus on what is important: column W, X and Y. I don't want to use cell references in column W and X but I want to directly inject the cell references in the formula in column Y, which results in 0 if I do so for every cell.

    I am still looking forward to a reply/solution for this problem.

    If you still think that this not Excel related, then please don't bother responding. It won't benefit anyone on this forum and I found it rather rude and disrespectful.

    Kind regards

  6. #6
    Forum Moderator Glenn Kennedy's Avatar
    Join Date
    07-08-2012
    Location
    Digital Nomad... occasionally based in Ireland.
    MS-Off Ver
    O365 (PC) V 2406
    Posts
    44,662

    Re: Using sumproduct gives 0 when using indirect directly in the formula

    Please see the file. Or ignore it, as you please.
    Attached Files Attached Files
    Last edited by Glenn Kennedy; 11-21-2018 at 03:19 PM.

  7. #7
    Forum Guru
    Join Date
    09-10-2017
    Location
    Chippenham, England
    MS-Off Ver
    365
    Posts
    15,634

    Re: Using sumproduct gives 0 when using indirect directly in the formula

    Your post does not comply with Rule 3 of our Forum RULES. Do not crosspost your question on multiple forums without including links here to the other threads on other forums.

    Cross-posting is when you post the same question in other forums on the web. The last thing you want to do is waste people's time working on an issue you have already resolved elsewhere. We prefer that you not cross-post at all, but if you do (and it's unlikely to go unnoticed), you MUST provide a link (copy the url from the address bar in your browser) to the cross-post.

    Expect cross-posted questions without a link to be closed and a message will be posted by the moderator explaining why. We are here to help so help us to help you!

    Read this to understand why we ask you to do this, and then please edit your first post to include links to any and all cross-posts in any other forums (not just this site).

    Please make sure to include the full link, so that other members will be permitted to continue helping you

    Note that if you have fewer than 10 posts, you may need to type the link, or past it in pieces (or ask a mod to do that for you)

  8. #8
    Registered User
    Join Date
    11-21-2018
    Location
    Belgium
    MS-Off Ver
    2013
    Posts
    9

    Re: Using sumproduct gives 0 when using indirect directly in the formula

    Hello Fluff13!

    Since you mentionned it on the other forum (Fluff?) as well (and actually added the link), would you please be so kind to do that here as well (tried it 2 times but got denied because of low number of posts). Also read the article about cross-posting, I can see why this might become an issue. Had no idea that forum experts were active on many different forums at once so totally get why this could become an issue.
    I'll remember this for future threads.

    Back to Glenn:

    I wouldn't quite understand why I would ignore it. Yes, you were a bit harsh on me but this might have been because you were going through the file too fast and perhaps didn't read what I was searching for and this got us in a misunderstanding.
    First of all, thank you for your solution.
    Second: would it be possible to explain in detail how you constructed that formula(s)? I've never seen/used the aggregate function for example or the column function based on the entire first column? Also the sumproduct functions are quite odd since I'm used to just 2 arrays normally. I don't tend to or want to build the most "performant" or "clean" function to be honest. I want to build a formula that I understand 100 % in each component so I can reuse and rebuild it for other purposes. I have absolutly no idea how I could reuse this one for other cases because I don't understand quite a bunch of the building blocks (not regarding the mathematics behind it).
    Unfortunately you also made no distinction between outliers and "-" values (I know I didn't specifically ask for this, but it did work in my sample ...) so I can't see how many outliers there are anymore. Changing "" to "N/A" won't help me since it also turns "-" to "N/A" in the if.error formula I assume.
    I hope that you aren't frustrated or mad at me for my reaction and that you are willing to take the time to explain this to me.

    Thanks in advance (again)!
    Kind regards

  9. #9
    Forum Guru
    Join Date
    09-10-2017
    Location
    Chippenham, England
    MS-Off Ver
    365
    Posts
    15,634

    Re: Using sumproduct gives 0 when using indirect directly in the formula


  10. #10
    Registered User
    Join Date
    11-21-2018
    Location
    Belgium
    MS-Off Ver
    2013
    Posts
    9

    Re: Using sumproduct gives 0 when using indirect directly in the formula

    Thank you very much Fluff13!

    Also additional note for Glenn:
    I noticed that you have made the a value change signs? I can't see why you did this? Omitting the - at the start of the formule right before the sumproduct. This also immediatly gives me correct values for b as well (the values that I had in my sample file). I have no idea if it can help you but I can't find out why you did it so ...

    Kind regards!

  11. #11
    Forum Moderator Glenn Kennedy's Avatar
    Join Date
    07-08-2012
    Location
    Digital Nomad... occasionally based in Ireland.
    MS-Off Ver
    O365 (PC) V 2406
    Posts
    44,662

    Re: Using sumproduct gives 0 when using indirect directly in the formula

    I asked about the maths because you were using a very convoluted way to reach your end point, and your end point was obscured by many INDIRECTS. Before I noticed your reply, I had gone quite some way to unpicking it to remove a lot of unnecessary calculations. When I saw your reply (and its intemperate language) I had two choices: delete my efforts, or post where I had got to. Against my better judgement, I decided to post what I had. So it's not perfect, but it is what it is.

    If you're interested we can try to finalise it.

    However, I have no intention of apologising for asking for an explanation of what you were attempting to do in your formulae.

  12. #12
    Registered User
    Join Date
    11-21-2018
    Location
    Belgium
    MS-Off Ver
    2013
    Posts
    9

    Re: Using sumproduct gives 0 when using indirect directly in the formula

    Hi again!

    Well there has been quite a misunderstanding then since I thought that you meant something completly different with your last sentence in that specific post ("Forget Excel" and "maths, not Excel, please ..."). I got the impression that you thought I asked a maths question and expected an Excel question so I don't know. So I was frustrated (and I assumed you were as well in your post).
    My objective is to make a linear regression (without the formula that is designed for it) it the components a and b according to Y = ax + b. The solution to this line that minimizes the error term is quite obvious but is rather annoying to split in multiple cells. It's much cleaner (I think it is) to get those in 1 cell only.
    Unfortunately, I made the export in reverse order. The datapoints had to be reversed so the regression line went in the right direction (I could have just copy pasted the columns a few times or something like that, but I like using inefficient formulas to do what I wanted).
    I then needed to make abstraction for myself if certain datapoints were outliers. I calculated them because I marked them with N/A while missing points were marked with "-" and I could make the distinction quite easely.
    Then, I had to rearrange the datapoints to omit the N/A values and the "-" values so there were no gaps in the data (or if I changed the sigma for the outliers, the regression lines would update automatically). I understand that you have done this using index and aggregate? I did it using indirect references which worked for me (again not looking for the most efficient or performant formulas).
    And then I had to calculate the actual a and b I was looking for. But I had to find a way to implement the sumproduct formula without the actual cell references calculated in 2 cells, I wanted that to all be in 1 cell only. So this is the problem that I had, which you solved but in a way I can't understand. So yes, it could be beneficial to know what I intended to do, even though I didn't ask for a cleaner way to do all of this (but you did and now I would like to get to know this aggregate construction). What I certainly would (still) like to know is: how could I have made it work with the cell references (indirect)? Yes, your formulas all work fine and give me the desired results, but as you probably have read before, I'm not looking for the perfect formula.
    The next step is to use these steps to calculate a weighted linear regression using array formulas and things like that. I have the solution for this, but it will use 3 arrays and not 2 so I really need to understand your formulas in order to start or try to make this type of regression.

    I hope that this explains why I reacted in the way I did. I would like to apologise for that and I hope that you are still willing to give me these additional details/information.

    Kind regards

  13. #13
    Forum Moderator Glenn Kennedy's Avatar
    Join Date
    07-08-2012
    Location
    Digital Nomad... occasionally based in Ireland.
    MS-Off Ver
    O365 (PC) V 2406
    Posts
    44,662

    Re: Using sumproduct gives 0 when using indirect directly in the formula

    Back in the morning. Feet up with a glass of vino tinto, now.

  14. #14
    Registered User
    Join Date
    11-21-2018
    Location
    Belgium
    MS-Off Ver
    2013
    Posts
    9

    Re: Using sumproduct gives 0 when using indirect directly in the formula

    Haha, enjoy yourself and have a great evening!
    See you tomorrow!

  15. #15
    Forum Moderator Glenn Kennedy's Avatar
    Join Date
    07-08-2012
    Location
    Digital Nomad... occasionally based in Ireland.
    MS-Off Ver
    O365 (PC) V 2406
    Posts
    44,662

    Re: Using sumproduct gives 0 when using indirect directly in the formula

    Not there yet. But. I'm an analytical chemist with yers experience in working with analytical results. I have a concern that you may be eliminating outliers in a non-valid way. I have simply used your definition in this sheet.
    Leave that for now. Lets get the rest done first.

    A7 to F12 contain dummy data that give blindingly obvious results (as a reality-check). You will see that there are some missing values and wild outliers (orange cells)

    1. There is no need to reverse the data order - as long as both X and Y are in the same ascending or descending order. So n is now being poicked up from J6 to O6.

    2. Use Excel's built in functions for Mean & SD. (are you measuring a sample from a population or the entire population - should you be using STDEV.P or STDEV.S

    3. A simple nested IF will return the value, or an M if it is missing or a Z if it is an outlier. These are then easily counted in I2 and I3.

    4. Excel's native functions for Slope and Intercept ignore the Z and M and returns the correct result for slope and intercept.

    The way you had this working in your previos sheet would have given you the wrong result:

    X: 1-2-3-4-5-6
    Y: 1-2-3-400-5-6

    would have become:

    X: 1,2,3,4,5
    Y: 1,2,3,5,6

    so your data would be out of sync. The picture pasted into the sheet shows your original sheet generating an incorrect result.

    So far, so good. Can you take a look at this and see if you'e OK with the maths and the Excel, up to this point...

    Next step... outliers... Are your primary measurements meant to have some linear dose-response relationship? Measured Y-values increasing in line with increases in the xalue on the X-axis... or am I misunderstanding you?
    Attached Files Attached Files

  16. #16
    Forum Moderator Glenn Kennedy's Avatar
    Join Date
    07-08-2012
    Location
    Digital Nomad... occasionally based in Ireland.
    MS-Off Ver
    O365 (PC) V 2406
    Posts
    44,662

    Re: Using sumproduct gives 0 when using indirect directly in the formula


  17. #17
    Registered User
    Join Date
    11-21-2018
    Location
    Belgium
    MS-Off Ver
    2013
    Posts
    9

    Re: Using sumproduct gives 0 when using indirect directly in the formula

    Hello Glenn

    So first off all, hats off to you for the very neat looking Excel file.
    I like the concern for the outliers and stuffs. I indeed messed something up with that stdev. I know those excel formulas but decided to not use them (idk why) and I didn't validate the outcomes (a "-" gives a 0 because it can't be calculated correctly using my formula and stdev ignores it). After changing this, I see that the other formula is also messed up a bit since it doesn't do what I wanted it to do.
    I still don't want to use the Intercept and Slope formulas since I need to go to a weighted regression and that I want to make it work with the actual solutions to those optimizations. But I got it to work with offset functions (still figuring out your initial formulas so idk).

    Then there are 2 mathematical questions or assumptions that you can make, depending on what is required.
    First off all: outlier detection and omitting outliers.
    1. Only outliers above a specific threshold should be omitted which is why I only test for items above the treshold of mean + SD*2. SD is based on n values and not (n-1) since this would mean the treshold would be higher which I didn't want. Ofcourse you can use (n-1) as well and just decrease the value of 2. Note that this is not meant as a statistical correct test nor is this for research purposes so I'm definately not worried about this. Normally you would perhaps assume normal distributions and alpha values of 2.33 or 2.575 but that is all out of the question.
    2. What you are doing is omitting outliers but there is still a gap. This means that the values that come after the outlier, have a higher "weight" in the regression. I didn't want this to happen. If there is an outlier, this value is treated as completly omitted, as if the value wasn't there in the first place (you can then say: don't you have to calculate the SD again and everything after omitting but that is a bit meh ...).
    The difference is that I expect the next value (as in forecast) to be smaller than what you are calculating.
    Example:
    X: 1-2-3-4-5-6
    Y: 11-21-31-400-51-61
    Regression according to you: Y = 10X + 1
    The next X value would be 7 and therefore: Y = 10*7 + 1 = 71
    My regression would be based on:
    X: 1-2-3-4-5
    Y: 11-21-31-51-61
    Therefore: Y = 13X - 17
    The next X value would be 6 and so we get: Y = 13*6 - 17 = 61
    I can imagine that the way I use this might upset you since this is a very unorthodox way of calculating forecasts and stuff like that.

    It also has to be quite simplistic so I don't need statistics (I've had my fair share of them and I know how to use them, they are just not required for this kind of calculations).

    I guess that I've covered everything that you asked/explained so feel free to comment on my view on this. Do you have a better way for outlier detection on such small data samples without going into statistical mumbo-jumbo? Feel free to let me know Just bear in mind that I am still a student actually so don't start with very complex calculations or matrices because that is most probably not required for this, or for what I need.

    Kind regards and glad you provided me with this excellent information and help!

  18. #18
    Forum Moderator Glenn Kennedy's Avatar
    Join Date
    07-08-2012
    Location
    Digital Nomad... occasionally based in Ireland.
    MS-Off Ver
    O365 (PC) V 2406
    Posts
    44,662

    Re: Using sumproduct gives 0 when using indirect directly in the formula

    Ooops. i forgot about you...

    1. Outliers. Your definition of an outlier is a bit strange sounding to me. I don't know what sort of measurements you're making.. you didn't answer my Q about whether this was some sort of dose-response relationship. In a classical calibration curve, I'd be looking for points that are significantly removed from the line of best fit (either above or below), classifying htem as outliers and removing htem. Whatever you're doing... it's different. So if you are content that your approach is valid... then stick with it.

    2. Next value. I won't get upset about anything you do... However, I do think your approarch is, at best, unconventional, verging on the weird!! However (as previously mentioned), since I have no idea what the numbers actually represent... I can't criticise the approach you're using. So if you are content that your approach is valid... then stick with it.

  19. #19
    Registered User
    Join Date
    11-21-2018
    Location
    Belgium
    MS-Off Ver
    2013
    Posts
    9

    Re: Using sumproduct gives 0 when using indirect directly in the formula

    Hi Glenn

    No problem
    Data is regarding sales/purchasing so don't worry about outliers or methodology etc ...
    Especially since you can't forecast or model this type of sales due to the high number of elements of which a lot are unknown.
    If you have a nice approach for this, just let me know!

    Thanks already for all the previous things you've done or explained. Helped me a lot!

    Kind regards

  20. #20
    Forum Moderator Glenn Kennedy's Avatar
    Join Date
    07-08-2012
    Location
    Digital Nomad... occasionally based in Ireland.
    MS-Off Ver
    O365 (PC) V 2406
    Posts
    44,662

    Re: Using sumproduct gives 0 when using indirect directly in the formula

    You're welcome.



    If that takes care of your original question, please select "Thread Tools" from the menu link above and mark this thread as SOLVED.

    It'd also be appreciated if you were to click the Add Reputation button at the foot of any of the posts of all members who helped you reach a solution.

+ 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. [SOLVED] Sumproduct & indirect formula
    By tshepolt in forum Excel Formulas & Functions
    Replies: 3
    Last Post: 07-20-2018, 02:41 AM
  2. indirect and sumproduct in one formula
    By Tashaz in forum Excel Formulas & Functions
    Replies: 1
    Last Post: 07-09-2018, 01:59 AM
  3. [SOLVED] Sumproduct Indirect Formula
    By ghostexcel in forum Excel Formulas & Functions
    Replies: 1
    Last Post: 01-23-2017, 06:21 AM
  4. [SOLVED] sumproduct + indirect formula
    By cpmsimoes in forum Excel Formulas & Functions
    Replies: 4
    Last Post: 03-11-2016, 10:35 PM
  5. [SOLVED] Sumproduct-Sumif-Indirect Formula Problem
    By PJH008 in forum Excel Formulas & Functions
    Replies: 7
    Last Post: 02-08-2016, 04:52 AM
  6. [SOLVED] Using Indirect in Sumproduct formula
    By Kleev in forum Excel Programming / VBA / Macros
    Replies: 1
    Last Post: 11-21-2005, 05:15 PM
  7. [SOLVED] include INDIRECT function into SUMPRODUCT formula
    By markx in forum Excel Formulas & Functions
    Replies: 1
    Last Post: 11-09-2005, 01:10 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