+ Reply to Thread
Results 1 to 9 of 9

Create Formula That Changes with Filter (Dynamic Range)

  1. #1
    Registered User
    Join Date
    12-29-2014
    Location
    Islamabad
    MS-Off Ver
    2013
    Posts
    12

    Create Formula That Changes with Filter (Dynamic Range)

    I Want to create (CountIf) formula that updates itself dynamically with Filter/Selection.
    In attached sheet our primary filter will be "Village" and we want to see statistics (Like Still Births) changing with selection.

    Any Help?
    Attached Files Attached Files

  2. #2
    Forum Expert teylyn's Avatar
    Join Date
    10-28-2008
    Location
    New Zealand
    MS-Off Ver
    Excel 365 Insider Fast
    Posts
    11,372

    Re: Create Formula That Changes with Filter (Dynamic Range)

    You are already using a pivot table. That is much more efficient than creating formulas. If you want to track several statistics at the same time, you may need to create several pivot tables next to each other. Instead of using filters, use slicers. A slicer (which is a filter with a nicer user interface) can be connected to several pivot tables and filter all of them at the same time.

    If you find that the pivot table does not give you the correct result, consider refreshing the pivot table. The one in your file does need to be refreshed, because the data on the data sheet is not showing up.
    Last edited by teylyn; 12-30-2014 at 02:58 AM.

  3. #3
    Registered User
    Join Date
    12-29-2014
    Location
    Islamabad
    MS-Off Ver
    2013
    Posts
    12

    Re: Create Formula That Changes with Filter (Dynamic Range)

    Dear Teylyn
    Thank You so much for your response. I hope this will do the the trick. Little more help plz as am merely a beginner.
    If I put "Marital Status" in the "Row Label" field this only shows field as "heading". On the other hand if I put the same in Values field, it only give count. How can I achieve Something like

    Divorced Married Grand Total
    5 5 10

    Kind Regards
    Azhar

  4. #4
    Forum Expert teylyn's Avatar
    Join Date
    10-28-2008
    Location
    New Zealand
    MS-Off Ver
    Excel 365 Insider Fast
    Posts
    11,372

    Re: Create Formula That Changes with Filter (Dynamic Range)

    Please see the attached file. I have used data up to row 1000 and put in some dummy values for different villages so we can see some results when we filter.

    I have created a Report sheet and added three pivot tables to it. In each pivot table, drag the field you want to count to the row area and drag it again to the values area. This will then give you a count for each distinct value of the field.

    If you want to see the different values arranged horizontally instead of vertically, then you drag the field to the Columns area instead of the Rows area. Excel will not allow overlapping pivot tables, so you may want to start a new sheet from scratch with your preferred layout.

    I have added four slicers to the report sheet. Then I selected each pivot table in turn and clicked "Filter Connections" on the Pivot Table Analyze ribbon and ticked all boxes. This means that the slicers are now connected to ALL the pivot tables currently on the sheet and when I select a village, all pivot tables get filtered for that village.

    The screenshot shows the report filtered for all married females in Bagh Killi. Attached is the file used to take the screenshot. Take a look and let me know how you get on.

    2014-12-30_21-03-17.png
    HDF Program Villages and progress-HLTH (1).xlsx

  5. #5
    Registered User
    Join Date
    12-29-2014
    Location
    Islamabad
    MS-Off Ver
    2013
    Posts
    12

    Re: Create Formula That Changes with Filter (Dynamic Range)

    Yeh...Thank you so much for your time and help

  6. #6
    Registered User
    Join Date
    12-29-2014
    Location
    Islamabad
    MS-Off Ver
    2013
    Posts
    12

    Re: Create Formula That Changes with Filter (Dynamic Range)

    Dear Tylyn.

    Little more help regarding above problem. In the pivot Tables, how do we see count against row values. For example, for Nutritional Status, You have selected a single field but count of numbers are appearing against each category. How to achieve this?

  7. #7
    Forum Expert teylyn's Avatar
    Join Date
    10-28-2008
    Location
    New Zealand
    MS-Off Ver
    Excel 365 Insider Fast
    Posts
    11,372

    Re: Create Formula That Changes with Filter (Dynamic Range)

    In the file I posted, the field "Nutritional Status" has been dragged into the Rows panel and also into the Values panel. This will create a row for each distinct text value in "Nutritional Status" and will count how often that value exists in the data, allowing for the filters.

    In the file and the screenshot you can see that of the 20 married females in Bagh Killi, 13 are normal weight, 5 are obese and 2 underweight. Click in the pivot table and then look at the Pivot Table panel to see the details.

    Text fields will automatically return a count.

    Numeric fields may return a count, but can be changed to return a sum (or other aggregation) instead.

  8. #8
    Registered User
    Join Date
    12-29-2014
    Location
    Islamabad
    MS-Off Ver
    2013
    Posts
    12

    Re: Create Formula That Changes with Filter (Dynamic Range)

    Yes...that did it...I didn't know that simply dragging the field to values section will work.

    Little more help please.
    How do I connect two different different Pivot Tables to same slicer. I want to track indicators for a different programs too for the same population or at least same villages.
    This is what I have done.
    1. Created date on separate sheet (Data-2)
    2. Created a pivot table on "Reports"

    Now I want to connect Pivot Table generated from (Data-2) to previously created slicer.

    I tried to get help from google but that looks bit more complex.

    Please help and I apologize for taking your time.

    Kind Regards
    Azhar

  9. #9
    Forum Expert teylyn's Avatar
    Join Date
    10-28-2008
    Location
    New Zealand
    MS-Off Ver
    Excel 365 Insider Fast
    Posts
    11,372

    Re: Create Formula That Changes with Filter (Dynamic Range)

    To connect a slicer to more than one pivot table, all pivot tables must be built on the same source data. Create the slicers for one pivot table. Then select another pivot table and click "Filter Connections" on the Pivottable Tools Analyze ribbon. The dialog will show all filters that are available for the selected pivot table and you can tick the ones that you want to connect to the current pivot table.

    If you want to compare different villages, then I suggest you use one pivot table and drag the Village to the top of the Rows area. Then use the slicer to select the desired villages. You can use Shift-Click to select contiguous values and Ctrl-Click to select values that are not next to each other.

    village in rows.png

    To see the villages side by side, drag the village field to the columns area. Keep in mind that if your data set is very big, the pivot table will expand to many columns if you clear the slicer filter. Since pivot tables are not permitted to overlap you need to factor that in when you design your dashboard. With village in the columns, you should not have pivot tables to the right of that one, so you can select as many villages as you want without overlapping other data when the pivot table expands.

    village in columns.png

+ 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. Advanced Filter to Dynamic Range
    By John in forum Excel Programming / VBA / Macros
    Replies: 7
    Last Post: 06-13-2019, 12:06 AM
  2. [SOLVED] VBA to update Dynamic Range in filter
    By shiva_reshs in forum Excel Programming / VBA / Macros
    Replies: 4
    Last Post: 03-10-2014, 04:21 PM
  3. [SOLVED] Create a dynamic custom filter
    By niko79542 in forum Excel Programming / VBA / Macros
    Replies: 1
    Last Post: 07-24-2012, 04:02 PM
  4. dynamic date range filter from cell value in vba
    By rustycanada in forum Excel Programming / VBA / Macros
    Replies: 4
    Last Post: 07-25-2011, 06:47 PM
  5. Filter Range based on dynamic range
    By afb215 in forum Excel Programming / VBA / Macros
    Replies: 6
    Last Post: 11-15-2010, 03:07 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