+ Reply to Thread
Results 1 to 10 of 10

Is there a way to have cell equal to autofilter?

  1. #1
    Registered User
    Join Date
    01-18-2008
    Posts
    15

    Is there a way to have cell equal to autofilter?

    I have 2 worksheets, and I was wondering if I can have a cell from Sheet2 equal to the subtotal of the Autofilter criteria of a column in Sheet1.
    I do have something working with macros but it takes a long time. This would make things a lot easier.

    Thanks

  2. #2
    Forum Expert NBVC's Avatar
    Join Date
    12-06-2006
    Location
    Mississauga, CANADA
    MS-Off Ver
    2003:2010
    Posts
    34,898
    You mean something like:

    =Subtotal(9,Sheet1!A:A)

    which will sum filtered data in column A of Sheet1
    Where there is a will there are many ways.

    If you are happy with the results, please add to the contributor's reputation by clicking the reputation icon (star icon) below left corner

    Please also mark the thread as Solved once it is solved. Check the FAQ's to see how.

  3. #3
    Registered User
    Join Date
    01-18-2008
    Posts
    15
    Yes, but then I want different cell on sheet2 to be the subtotal of the same column but with a different autofilter criteria.

  4. #4
    Forum Expert NBVC's Avatar
    Join Date
    12-06-2006
    Location
    Mississauga, CANADA
    MS-Off Ver
    2003:2010
    Posts
    34,898

  5. #5
    Registered User
    Join Date
    01-18-2008
    Posts
    15
    Thanks for the help, but this still requires you to manually change the autofilter criteria. Is there any way the cell can filter it by itself?

  6. #6
    Forum Expert NBVC's Avatar
    Join Date
    12-06-2006
    Location
    Mississauga, CANADA
    MS-Off Ver
    2003:2010
    Posts
    34,898
    You can't automatically change the autofilter criteria unless you use VBA as you already have done....

    ... do you know about the Countif() and Sumif() functions.... these count and sum based on specific criteria...maybe this is really what you want?

    e.g. =Countif(Sheet1!A:A,A2) will count items in column A of Sheet 1 that have the criteria you put in A2 of your active sheet.

    likewise, =Sumif(Sheet1!A:A,A2,Sheet1!B:B) will sum items in B based on criteria as I described with the Countif above....

  7. #7
    Registered User
    Join Date
    01-18-2008
    Posts
    15
    Do you know how to do COUNTIF with multiple conditions? Been trying it for a while.

  8. #8
    Forum Expert NBVC's Avatar
    Join Date
    12-06-2006
    Location
    Mississauga, CANADA
    MS-Off Ver
    2003:2010
    Posts
    34,898
    If you have 2007, it's Countifs()

    If you don't have 2007, you have to use Sumproduct() for multiple conditions...

    e.g. =Sumproduct(--(A1:A100=Condition1),--(B1:B100=Condition2))

    you can continue adding conditions under the same pattern.

  9. #9
    Registered User
    Join Date
    01-18-2008
    Posts
    15
    It appears the sumproduct function is not working properly.
    So I tried finding out whats wrong.
    When I write
    =Sheet1!C6:C2610=A2 in a cell i get the #VALUE! error.
    When I write
    =Sheet1!C:C=A2 in a cell is says FALSE but the value in A2 is in that range (column C) of sheet 1.

  10. #10
    Forum Expert NBVC's Avatar
    Join Date
    12-06-2006
    Location
    Mississauga, CANADA
    MS-Off Ver
    2003:2010
    Posts
    34,898
    What do you mean by it's not working properly?

    Do you get an error (which one)? - check for errors in the range....

    Do you get wrong result? - check that values in Column C match exactly what's in A2.... formats must be same and no extra spaces, etc...

    If you still have problem, please post sample zipped sheet (excel 2003 or earlier please).

+ 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