+ Reply to Thread
Results 1 to 5 of 5

Need code to exclude cells in autosum average based on other cell values

  1. #1
    Registered User
    Join Date
    08-07-2015
    Location
    Washington
    MS-Off Ver
    365, v1808 32bit
    Posts
    59

    Need code to exclude cells in autosum average based on other cell values

    Hi Folks,

    In a basic example, say I have data in cells A1 thru D20.

    I would make D21 a cell with a formula to average the values from D1,D20. But exclude a couple rows based on certain values that are entered in in the same row in column A.

    For instance, if cell A12 = ABC or DEF, then cell D12 would be excluded from the autosum of column D. This scenario could apply to multiple rows, and won't always be on the same rows. As in, there could be an instance where if cell A12 and A15 = ABC or DEF, exclude D12 and D15. (I'm thinking maybe a typical relative cell formula would be ideal so I could basically say if a cell 4 columns to the left contains certain values, then exclude from the autosum.)

    Hope this makes sense, and if so, perhaps someone can give me ideas.

  2. #2
    Forum Expert WideBoyDixon's Avatar
    Join Date
    10-03-2016
    Location
    Sheffield, UK
    MS-Off Ver
    365
    Posts
    2,182

    Re: Need code to exclude cells in autosum average based on other cell values

    You can use something like this:

    Please Login or Register  to view this content.
    WBD
    Office 365 on Windows 11, looking for rep!

  3. #3
    Registered User
    Join Date
    08-07-2015
    Location
    Washington
    MS-Off Ver
    365, v1808 32bit
    Posts
    59

    Re: Need code to exclude cells in autosum average based on other cell values

    Thanks WBD,

    That's quite helpful. Would you know how to integrate that into a relative cell format? My data won't always be between rows 1 and 20. Sometimes it could be more or less cells, so this is what I've just come up with to define the first and last row that needs to be in the equation.

    Please Login or Register  to view this content.
    I can do a simple average with something like this:

    Please Login or Register  to view this content.
    But I'm not quite sure how I can incorporate your suggestion as far as telling it to exclude the data from column A.

  4. #4
    Forum Expert WideBoyDixon's Avatar
    Join Date
    10-03-2016
    Location
    Sheffield, UK
    MS-Off Ver
    365
    Posts
    2,182

    Re: Need code to exclude cells in autosum average based on other cell values

    Try like this:

    Please Login or Register  to view this content.
    WBD

  5. #5
    Registered User
    Join Date
    08-07-2015
    Location
    Washington
    MS-Off Ver
    365, v1808 32bit
    Posts
    59

    Re: Need code to exclude cells in autosum average based on other cell values

    Brilliant! Works great. Thanks much

+ 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. Average of last 5 values but to exclude any blank cells.
    By tb2000 in forum Excel Formulas & Functions
    Replies: 13
    Last Post: 01-12-2019, 03:14 PM
  2. Exclude Values from Average formula
    By pavankumarbangaru in forum Excel Formulas & Functions
    Replies: 1
    Last Post: 08-27-2018, 02:58 PM
  3. Copy values from Pivot Table but exclude certain data based on cell value
    By FellowofJest in forum Excel Programming / VBA / Macros
    Replies: 0
    Last Post: 09-04-2013, 04:59 AM
  4. Replies: 8
    Last Post: 02-16-2011, 05:03 PM
  5. How to average cells but exclude 0 values?
    By Billznik in forum Excel Formulas & Functions
    Replies: 3
    Last Post: 07-27-2008, 06:26 AM
  6. Average needed, but want to exclude some values
    By hibiscus27 in forum Excel Formulas & Functions
    Replies: 3
    Last Post: 04-19-2007, 10:49 AM

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