+ Reply to Thread
Results 1 to 13 of 13

Quick/Simple problem: Average function based on filtering rows? (please help!)

  1. #1
    Registered User
    Join Date
    11-26-2014
    Location
    London, England
    MS-Off Ver
    2010
    Posts
    6

    Quick/Simple problem: Average function based on filtering rows? (please help!)

    *In row 32 I would like to type a number from the range in the same column above and have it filter only rows with that value before generating the average of each column and displaying the result in row 33. (Note: I don't need any of the rows to be hide/re-appear - just for averages to change as I change value in any row 32 cell)

    For example, if I type 2 in A32 then I am only interested in finding the averages of the following rows/colums:

    2 3 0 6 10 1 0 11
    2 3 0 1 5 0 3 9
    2 3 0 0 4 0 1 10

    The results should then display in row 33 (except maybe for in A33; that doesn't necessarily have to show anything):
    2 3 0 2.333333333 6.333333333 0.333333333 1.333333333 10

    Any help would be much appreciated!

    \1
    http://www.filedropper.com/book2_4 (download workbook)
    Book2.xlsx
    Attached Images Attached Images
    Last edited by gilius; 11-26-2014 at 01:41 PM.

  2. #2
    Forum Guru Pete_UK's Avatar
    Join Date
    12-31-2011
    Location
    Warrington, England
    MS-Off Ver
    Office 2019 (still learning)
    Posts
    25,408

    Re: Quick/Simple problem: Average function based on filtering rows? (please help!)

    A picture is not much use - attach the sample workbook instead, as contributors are unlikely to spend a lot of time to re-create your sheet.

    Hope this helps.

    Pete

  3. #3
    Registered User
    Join Date
    11-26-2014
    Location
    London, England
    MS-Off Ver
    2010
    Posts
    6

    Re: Quick/Simple problem: Average function based on filtering rows? (please help!)

    OK thanks Pete! I believe I've now successfully attached it after editing my opening post - though I've also hosted it on an external site just in case.
    http://www.filedropper.com/book2_4 (download workbook)

  4. #4
    Forum Guru Pete_UK's Avatar
    Join Date
    12-31-2011
    Location
    Warrington, England
    MS-Off Ver
    Office 2019 (still learning)
    Posts
    25,408

    Re: Quick/Simple problem: Average function based on filtering rows? (please help!)

    I'm a bit confused as to what you want to do. In your first post you gave an example of entering 2 into cell A32, but the values in A1:A30 seem to be the equivalent of the row (or record) number. I think what you mean is that you want to be able to enter a value into one of the cells (only) in B32 to M32, and then to have B33:M33 display the average of each column where the values in the selected column are equal to the chosen value. If so, you can put this formula in B33:

    =IF(OR(SUM($B$32:$M$32)=0,COUNT($B$32:$M$32)>1),0,AVERAGEIFS(B$1:B$30,INDEX($B$1:$M$30,,MATCH(SUM($B$32:$M$32),$B$32:$M$32,0)),SUM($B$32:$M$32)))

    and copy across to M33. Then you can enter any value in one of the cells in B33:M33 and get the average for each column. You will get zeros if you have more than one cell with a value, or if they are all empty.

    Hope this helps.

    Pete

  5. #5
    Registered User
    Join Date
    11-26-2014
    Location
    London, England
    MS-Off Ver
    2010
    Posts
    6

    Re: Quick/Simple problem: Average function based on filtering rows? (please help!)

    I think what you mean is that you want to be able to enter a value into one of the cells (only) in B32 to M32, and then to have B33:M33 display the average of each column where the values in the selected column are equal to the chosen value.
    Many thanks Pete! That works perfect for entering into one cell only, but I would be really grateful if you could get it to work based on multiple values in row 32? Apologies for not making it clear!

  6. #6
    Forum Guru Pete_UK's Avatar
    Join Date
    12-31-2011
    Location
    Warrington, England
    MS-Off Ver
    Office 2019 (still learning)
    Posts
    25,408

    Re: Quick/Simple problem: Average function based on filtering rows? (please help!)

    I'm going out soon, so I don't have time to think about that further requirement - perhaps someone else will chip in.

    Pete

  7. #7
    Forum Expert
    Join Date
    12-24-2007
    Location
    Alsace - France
    MS-Off Ver
    MS 365 Office Suite
    Posts
    5,085

    Re: Quick/Simple problem: Average function based on filtering rows? (please help!)

    See attached another way, if I have understood correctly
    Attached Files Attached Files
    - Battle without fear gives no glory - Just try

  8. #8
    Registered User
    Join Date
    11-26-2014
    Location
    London, England
    MS-Off Ver
    2010
    Posts
    6

    Re: Quick/Simple problem: Average function based on filtering rows? (please help!)

    Hi PCI,

    Thanks for also taking a look at this! Yours works as good as Pete's and uses a different method, so if I enter 2 in B32 it will select the rows with value 2 and then figure out the conditional averages of each column:

    Please Login or Register  to view this content.
    Averages are:

    Please Login or Register  to view this content.
    So that works great, but there's 1 problem and 1 additional feature I would be most grateful to have included.


    Problem is if I enter 0 in E32:

    It should select these rows during the calculation:
    Please Login or Register  to view this content.
    But it just comes up as invalid for the averages, as I think the validation doesn't factor in zeroes.


    Now the additional feature I would love to have would involve multiple criteria for the conditional averages:

    If I enter 2 in B32 and 0 in E32, it should select just one row and return that same row as the average since there are no other rows to compare in this instance:

    Please Login or Register  to view this content.
    I realise this may involve some kind of complex nested formula or possibly VBA code, but I'll happily pay $20 or more if somebody can implement it in full?

  9. #9
    Forum Expert
    Join Date
    12-24-2007
    Location
    Alsace - France
    MS-Off Ver
    MS 365 Office Suite
    Posts
    5,085

    Re: Quick/Simple problem: Average function based on filtering rows? (please help!)

    There is a possibility to do it with VBA.
    What about column "A", do we forget it?
    What about the use of a filter and just a simple macro to average data? If it's OK we need headers

  10. #10
    Registered User
    Join Date
    11-26-2014
    Location
    London, England
    MS-Off Ver
    2010
    Posts
    6

    Re: Quick/Simple problem: Average function based on filtering rows? (please help!)

    Yeah, column A can be ignored.

    Could you possibly attempt it on this new attached spreadsheet please, if you get a chance, but in the space at the top?

    WARRIORS.zip

  11. #11
    Forum Expert
    Join Date
    12-24-2007
    Location
    Alsace - France
    MS-Off Ver
    MS 365 Office Suite
    Posts
    5,085

    Re: Quick/Simple problem: Average function based on filtering rows? (please help!)

    Have look in the file attached, using SUBTOTAL with filter and comment
    Attached Files Attached Files

  12. #12
    Forum Expert
    Join Date
    12-24-2007
    Location
    Alsace - France
    MS-Off Ver
    MS 365 Office Suite
    Posts
    5,085

    Re: Quick/Simple problem: Average function based on filtering rows? (please help!)

    The same with your file
    Attached Files Attached Files

  13. #13
    Registered User
    Join Date
    11-26-2014
    Location
    London, England
    MS-Off Ver
    2010
    Posts
    6

    Thumbs up Re: Quick/Simple problem: Average function based on filtering rows? (please help!)

    That seems perfect!!! MANY THANKS INDEED, CHEERS! Drop me a pm with your PayPal addy if you would like me to make a donation for your efforts. I'm sure Pete would have come up with a solution too - it's just I wasn't very good at explaining things in the beginning.

    THANKS AGAIN PCI!

+ 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. how to make quick filtering rows macro?
    By astuntas in forum Excel Programming / VBA / Macros
    Replies: 2
    Last Post: 08-01-2014, 04:38 AM
  2. Filtering problem and having two rows acting as one
    By alakt in forum Excel Programming / VBA / Macros
    Replies: 0
    Last Post: 02-13-2012, 12:10 PM
  3. Replies: 3
    Last Post: 07-21-2011, 03:15 AM
  4. [SOLVED] Quick help with a simple function!
    By bobbly_bob@hotmail.com in forum Excel General
    Replies: 4
    Last Post: 07-20-2006, 01:25 AM
  5. [SOLVED] Excel should have a quick and simple "change case" function like .
    By NinaSvendsen in forum Excel Formulas & Functions
    Replies: 1
    Last Post: 01-28-2005, 02:06 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