+ Reply to Thread
Results 1 to 10 of 10

One cell in an array forumla not returning expected values

  1. #1
    Forum Contributor
    Join Date
    07-30-2012
    Location
    Seattle, WA
    MS-Off Ver
    Excel 2010
    Posts
    139

    One cell in an array forumla not returning expected values

    I am using an array forumla to calculate non blank cells in a range from another table. The array forumula works great for each row except the last one where it is returning a 0 instead of the expected 2.

    Does anyone have any idea what could be causing this?

    Thanks

    Please Login or Register  to view this content.

  2. #2
    Forum Expert
    Join Date
    09-01-2012
    Location
    Norway
    MS-Off Ver
    Office 365
    Posts
    2,844

    Re: One cell in an array forumla not returning expected values

    Maybe a space in the empty cell?
    <----- If you were helped by my posts you can say "Thank you" by clicking the star symbol down to the left

    If the problem is solved, finish of the thread by clicking SOLVED under Thread Tools
    I don't wish to leave you with no answer, yet I sometimes miss posts. If you feel I forgot you, remind me with a PM or just bump the thread.

  3. #3
    Forum Expert bebo021999's Avatar
    Join Date
    07-22-2011
    Location
    Vietnam
    MS-Off Ver
    Excel 2016
    Posts
    9,466

    Re: One cell in an array forumla not returning expected values

    Is it finished by Ctrl-Shift-Enter? Try to CSE or copy the correct row and paste again.
    Quang PT

  4. #4
    Administrator FDibbins's Avatar
    Join Date
    12-29-2011
    Location
    Duncansville, PA USA
    MS-Off Ver
    Excel 7/10/13/16/365 (PC ver 2310)
    Posts
    52,938

    Re: One cell in an array forumla not returning expected values

    space in an empty cell, or leading/training spaces in text?
    1. Use code tags for VBA. [code] Your Code [/code] (or use the # button)
    2. If your question is resolved, mark it SOLVED using the thread tools
    3. Click on the star if you think someone helped you

    Regards
    Ford

  5. #5
    Forum Contributor
    Join Date
    07-30-2012
    Location
    Seattle, WA
    MS-Off Ver
    Excel 2010
    Posts
    139

    Re: One cell in an array forumla not returning expected values

    I went through and looked for trailing / leading spaces as well as rogue spaces in the table data but I still wasn't able to correct the problem. I even changed my naming scheme and went through and re-entered the numerical values to try to ensure data integrity, but the problem is still there. I wonder if someone would be willing to look at my spreadsheet for me and see if they can tell what the problem might be?

    The issue is occurring on the "Average Data" worksheet. The number 2 should be in cell D31 because there are 2 data instances on tab jan-march for the last row.

    Thank for any suggestions.

    SpreadSheet.zip
    Last edited by brharrii; 04-08-2013 at 01:34 PM. Reason: missing information

  6. #6
    Administrator FDibbins's Avatar
    Join Date
    12-29-2011
    Location
    Duncansville, PA USA
    MS-Off Ver
    Excel 7/10/13/16/365 (PC ver 2310)
    Posts
    52,938

    Re: One cell in an array forumla not returning expected values

    2 things....

    1. you formula in Jan-Mar stops at row 195

    2. here is a simpler formula than the array you are using....
    =IF(SUMIFS('Jan-March'!B:B,'Jan-March'!E:E,$B5,'Jan-March'!B:B,"<>")=0,"",SUMIFS('Jan-March'!B:B,'Jan-March'!E:E,$B5,'Jan-March'!B:B,"<>"))

  7. #7
    Forum Expert Tony Valko's Avatar
    Join Date
    12-31-2011
    Location
    Pittsburgh
    MS-Off Ver
    2002, 2007:2013
    Posts
    18,890

    Re: One cell in an array forumla not returning expected values

    Try it like this...

    =IFERROR(1/(1/SUMIF('Jan-March'!E:E,$B5,'Jan-March'!B:B)),"")
    Biff
    Microsoft MVP Excel
    Keep It Simple Stupid

    Let's Go Pens. We Want The Cup.

  8. #8
    Forum Contributor
    Join Date
    07-30-2012
    Location
    Seattle, WA
    MS-Off Ver
    Excel 2010
    Posts
    139

    Re: One cell in an array forumla not returning expected values

    Quote Originally Posted by FDibbins View Post
    2 things....

    1. you formula in Jan-Mar stops at row 195

    2. here is a simpler formula than the array you are using....
    =IF(SUMIFS('Jan-March'!B:B,'Jan-March'!E:E,$B5,'Jan-March'!B:B,"<>")=0,"",SUMIFS('Jan-March'!B:B,'Jan-March'!E:E,$B5,'Jan-March'!B:B,"<>"))
    Thanks for the suggestions, which formula are you referring to?

    I'll play with the new one you sent me too. Thanks!

  9. #9
    Forum Contributor
    Join Date
    07-30-2012
    Location
    Seattle, WA
    MS-Off Ver
    Excel 2010
    Posts
    139

    Re: One cell in an array forumla not returning expected values

    Thanks Tony, I'll play with this one too. I've never used the "1/" function before. What does it do? Love learning new things!

  10. #10
    Forum Expert Tony Valko's Avatar
    Join Date
    12-31-2011
    Location
    Pittsburgh
    MS-Off Ver
    2002, 2007:2013
    Posts
    18,890

    Re: One cell in an array forumla not returning expected values

    In Excel we can say that 1/(1/some number) will always equal some number *except* for when some number = 0. In that case 1/(1/0) will return a #DIV/0! error.

    This is a shorthand method of error trapping. If the result of the SUMIF is 0 you wanted to return a blank instead.

    So, instead of using this for the 0 test:

    =IF(SUMIFS('Jan-March'!B:B,'Jan-March'!E:E,$B5,'Jan-March'!B:B,"<>")=0,"",

    We can replace that with the shorter and more efficient:

    =IFERROR(1/(1/.....),"")

    If the SUMIF results in 0 then 1/(1/0) returns #DIV/0! and the IFERROR traps the error and returns a blank instead.

+ 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