+ Reply to Thread
Results 1 to 3 of 3

Nesting If Statements Within an Average Array Calculation

  1. #1
    Registered User
    Join Date
    01-08-2020
    Location
    California
    MS-Off Ver
    Office 365
    Posts
    2

    Nesting If Statements Within an Average Array Calculation

    I am trying to create a simple way for anyone using my spreadsheet to see an average calculation using data disaggregated by one or more demographics. Using an array, I have been able to calculate the average if there is a value selected for each of the demographics, but I cannot figure out how to make it work if the the user does not want to disaggregate the data by one or more of the demographics. I'm assuming I would need to add some addition If statements, but I'm not sure where to start. Any help is much appreciated!

    Screenshot 2020-01-08 08.55.33.png

    The formula I am using is: =AVERAGE(IF(AllResponses_Edited!A:A=B2,IF(AllResponses_Edited!B:B=B3,IF(AllResponses_Edited!C:C=B4,IF(AllResponses_Edited!D:D=B5,IF(AllResponses_Edited!E:E=B6,IF(AllResponses_Edited!F:F=B7,IF(AllResponses_Edited!G:G=B8,IF(AllResponses_Edited!H:L<>"",AllResponses_Edited!H:L)))))))))

    Note that this spreadsheet is using all dummy data; it contains no private information.
    Attached Files Attached Files

  2. #2
    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,944

    Re: Nesting If Statements Within an Average Array Calculation

    Hi, welcome to the forum

    perhaps it would help (us) if you added some headings to you data table, and ID'd what the different indexes are for?
    I have a feeling that SUMPRODUCT or AVERAGEIF may be what you need here.
    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

  3. #3
    Registered User
    Join Date
    01-08-2020
    Location
    California
    MS-Off Ver
    Office 365
    Posts
    2

    Re: Nesting If Statements Within an Average Array Calculation

    Thank you! It's good to be here.

    I've added data headers in the attached. Thanks for the suggestion. It's my understanding that the Averageifs formula won't work if the data being averaged spans a different number of columns than for the if criteria. I suppose I could adjust my data format to resolve this. But, even so, I'm still not sure how I would achieve the goal of being able to choose to filter by one or more demographics rather than all. Essentially, how do I make it work if someone selects "Any" from one or more of the dropdowns I've created?

    Appreciate the help!

    -Elizabeth
    Attached Files Attached Files

+ 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. Nesting IF Statements
    By glail in forum Excel General
    Replies: 1
    Last Post: 02-04-2017, 10:58 AM
  2. Replies: 8
    Last Post: 06-09-2015, 09:59 AM
  3. Nesting IF and OR statements
    By cheeky300 in forum Excel Formulas & Functions
    Replies: 1
    Last Post: 02-20-2014, 08:17 AM
  4. Nesting IF OR statements
    By cara13xxi in forum Excel Formulas & Functions
    Replies: 5
    Last Post: 04-23-2013, 12:30 PM
  5. nesting more than 7 if statements
    By KAPearson in forum Excel Programming / VBA / Macros
    Replies: 4
    Last Post: 07-28-2012, 06:24 AM
  6. Nesting IF statements
    By penny in forum Excel Formulas & Functions
    Replies: 5
    Last Post: 10-03-2007, 04:02 PM
  7. Nesting If statements
    By RGPH in forum Excel Formulas & Functions
    Replies: 1
    Last Post: 07-05-2007, 11:05 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