+ Reply to Thread
Results 1 to 12 of 12

Array Formula does not return expected value when evaluated in one cell, but over two cell

  1. #1
    Registered User
    Join Date
    07-30-2012
    Location
    Abu Dhabi, UAE
    MS-Off Ver
    Excel 2007
    Posts
    5

    Array Formula does not return expected value when evaluated in one cell, but over two cell

    Hi,

    I am trying to use Array Formulas. All the components seem to work fine, but when I then try to evaluate it in just one cell I get unexpected results.

    Please have a look at the attached Spreadsheet. Cell B15 contains the starting point of my array formula - all the values in range B15:BD15 are exactly what I expect them to be.....so all fine, so far.

    Cell A15 now performs a sum over the range B15:BD15. The shown figure 4.05% is exactly what I would like to get as my end result. So I thought I could wrap a SUM() around the formula Array in B15 and evaluate it in Cell B16. Here is where my problem starts. No matter what I do, Excel refuses to return the value that I need: 4.05%. As you can see it returns 0%, which is obviously wrong - at least to me....

    What I find interesting though is that all seems to be working fine if I expand the area of the array to Range B17:C17. Now the expected result is being shown in both cells. But unfortunately this is useless to me as I definitely need it to work on just one cell.

    I am really confused. Maybe I am overlooking or not aware of some features of Array functions that I need to keep in mind.

    Thank you for any hint what is needed in order to get this to work.

    Best

    Nevs
    Attached Files Attached Files

  2. #2
    Forum Guru Jonmo1's Avatar
    Join Date
    03-08-2013
    Location
    Bryan, TX
    MS-Off Ver
    Excel 2010
    Posts
    9,763

    Re: Array Formula does not return expected value when evaluated in one cell, but over two

    I think you are WAY overthinking your task.
    You don't need array formula in B15:BD15.

    In B15 and filled right, put
    =IF(B3=$E$1,B7*B10,0)
    Although, that's not really necessary if the ultimate goal is the result in A15.

    In A15 put
    =SUMPRODUCT((B3:BD3=$E$1)*(B7:BD7)*(B10:BD10))

    Hope that helps.

  3. #3
    Forum Contributor arlu1201's Avatar
    Join Date
    09-09-2011
    Location
    Bangalore, India
    MS-Off Ver
    Excel 2003 & 2007
    Posts
    19,166

    Re: Array Formula does not return expected value when evaluated in one cell, but over two

    nevs1,

    I'm afraid your post does not comply with Rule 8 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).
    If I have helped, Don't forget to add to my reputation (click on the star below the post)
    Don't forget to mark threads as "Solved" (Thread Tools->Mark thread as Solved)
    Use code tags when posting your VBA code: [code] Your code here [/code]

  4. #4
    Registered User
    Join Date
    07-30-2012
    Location
    Abu Dhabi, UAE
    MS-Off Ver
    Excel 2007
    Posts
    5

    Re: Array Formula does not return expected value when evaluated in one cell, but over two

    Jonmo1,
    thank you very much, that does it for me. I agree, I must have overthought the problem by a mile. I guess I need to better understand when to use the approach you described and when to use: {}


    Arlu1201,
    thank you for pointint this out to me. I was not aware of it. Jonmo1 answered my question. I will make a crosspost later today.

  5. #5
    Registered User
    Join Date
    07-30-2012
    Location
    Abu Dhabi, UAE
    MS-Off Ver
    Excel 2007
    Posts
    5

    Re: Array Formula does not return expected value when evaluated in one cell, but over two

    Jonmo1,
    I was to quick to reply, and I guess I wasnt explicit enough in my initial question.

    Row10 only displays an intermediate step, which ultimately needs to converge into the solution. What I ultimately need is to switch between the behavior in Cell F10 and the new formula that I need to get to work in an IF statement. Let me explain:

    Cell F10 just references values in teh Ret! Sheet whenever Row2 has the value N. If Row2 has the value Y, then I need the weighted average of the Returns (so the values that I am displaying in Row 10 now, but that ultimately live in the Ret! Sheet). The weights that I need to use in order to come up with the weighted average are in Row 7. And I only need to multiply those returns and weights for those items where the value in Row3 (Group above row) is the same as the current group evaluated (Row1) - this is where the B3:BD3=$E$1 comes from.
    This is a perfect example of a circular reference as I cant be displaying information in Row 10 that uses other cells in Row10.

    So, long story short, the first answer to my original question gets it to work for the case I provided, but I guess I didnt provide the full complexity of the problem I am facing. I now that the components of the Formula that is in Cell E17, Excel just refuses to show the correct value unless I extend the area to at least two cells (E18:F18).

    Thank you very much for re-considering my problem.

    Nevs
    Attached Files Attached Files

  6. #6
    Forum Contributor arlu1201's Avatar
    Join Date
    09-09-2011
    Location
    Bangalore, India
    MS-Off Ver
    Excel 2003 & 2007
    Posts
    19,166

    Re: Array Formula does not return expected value when evaluated in one cell, but over two

    nevs1,

    You need to add to post 1 all links to other forums where you have posted this question.

  7. #7
    Forum Guru Jonmo1's Avatar
    Join Date
    03-08-2013
    Location
    Bryan, TX
    MS-Off Ver
    Excel 2010
    Posts
    9,763

    Re: Array Formula does not return expected value when evaluated in one cell, but over two

    You'll need to include the code for your reverse function. I'm guessing that's in an addin?
    Or describe the purpose of the formula in Row 3.
    Is that getting the text after the last _ ?

    Also, that last book you posted, is the formula in A15 getting the result you want, but you want to get that same result without the intermediate cells in B15:BD15 ?

  8. #8
    Forum Contributor arlu1201's Avatar
    Join Date
    09-09-2011
    Location
    Bangalore, India
    MS-Off Ver
    Excel 2003 & 2007
    Posts
    19,166

    Re: Array Formula does not return expected value when evaluated in one cell, but over two

    Jonmo1,

    The original poster has not complied with my statement in post 6 yet. Do not post until he/she complies.

  9. #9
    Registered User
    Join Date
    07-30-2012
    Location
    Abu Dhabi, UAE
    MS-Off Ver
    Excel 2007
    Posts
    5

    Re: Array Formula does not return expected value when evaluated in one cell, but over two

    Arlu1201,
    I was trying to add the cross link, but the other site was giving me some error message when I tried to figure out what the link of my post was. As I am blocked from Hotmail at work I wasn't able to retrieve the link from my emails. But now I am back home and here is the link to the other post:

    http://www.mrexcel.com/forum/excel-q...-new-post.html

    I definitely want to stick to the rules and by no means do I want to do something wrong or unnecessarily detract people.


    Jonmo1,
    the code for the function is below. It just reverses the text of a cell:

    Please Login or Register  to view this content.


    To your other question: Yes, I want the value of Cell A15. I can get it to work in Cells E18:F18, but not in E17. The only difference between the two is that in the former the array is over the 2 cells rather than just a single cell.
    Last edited by arlu1201; 04-09-2013 at 10:44 AM.

  10. #10
    Forum Guru Jonmo1's Avatar
    Join Date
    03-08-2013
    Location
    Bryan, TX
    MS-Off Ver
    Excel 2010
    Posts
    9,763

    Re: Array Formula does not return expected value when evaluated in one cell, but over two

    Then I don't understand the problem.

    If the result you have in A15 is the ultimate goal.
    But you want to achieve that goal without the intermediate calcs in B15:BD15

    Then use
    =SUMPRODUCT((B3:BD3=$E$1)*(B7:BD7)*(B10:BD10))

    Here is an example using that formula in A16 to show it gives the same result as A15 without the use of B15:BD15
    Check(1).xlsm
    Last edited by Jonmo1; 04-09-2013 at 10:41 AM.

  11. #11
    Forum Contributor arlu1201's Avatar
    Join Date
    09-09-2011
    Location
    Bangalore, India
    MS-Off Ver
    Excel 2003 & 2007
    Posts
    19,166

    Re: Array Formula does not return expected value when evaluated in one cell, but over two

    Ok thank you.

    Also,

    I have added code tags to your post # 9. As per forum rule 3, you need to use them whenever you put any code in your post. Please add them in future. In order to put code tags, either type [CODE]Please [url=https://www.excelforum.com/login.php]Login or Register [/url] to view this content.[/CODE] at the end of it, OR you can highlight your code and click the # icon at the top of your post window.

  12. #12
    Registered User
    Join Date
    07-30-2012
    Location
    Abu Dhabi, UAE
    MS-Off Ver
    Excel 2007
    Posts
    5

    Re: Array Formula does not return expected value when evaluated in one cell, but over two

    thank you all for your help in patience with me ultimately complying to all forum rules.... :-)

+ Reply to Thread

Thread Information

Users Browsing this Thread

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

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