+ Reply to Thread
Results 1 to 5 of 5

Populate Data Based on Multiple Criteria

  1. #1
    Forum Contributor
    Join Date
    08-19-2006
    MS-Off Ver
    Excel 365
    Posts
    229

    Populate Data Based on Multiple Criteria

    Hi ,

    I have a data table as attached in sheet "Data Table" which has the number of incidents of non compliance based on date, incident type, channel and outlet. The incident is indicated by "Y". One Y is equal to one incident.

    I need to summarize this based on the second and third sheet table.

    In the second sheet "Incident by month and channel", I need to summarize the number of incidents by channel and month.

    In the third sheet, I need to summarize by incident type , outlet and number of incidents. However, this is only for the period of Oct 2010 to Dec 2010 and is only for the channel of "Train Station".

    I have been doing this manually but the actual list is very long. I have no idea what formula to use and I would really appreciate for assistance. Appreciate your valuable time and effort.

    I have a cross post here:

    http://www.mrexcel.com/forum/showthread.php?t=523738
    Attached Files Attached Files

  2. #2
    Forum Moderator - RIP Richard Buttrey's Avatar
    Join Date
    01-14-2008
    Location
    Stockton Heath, Cheshire, UK
    MS-Off Ver
    Office 365, Excel for Windows 2010 & Excel for Mac
    Posts
    29,464

    Re: Populate Data Based on Multiple Criteria

    Hi,

    See the attached. I have used dynamic range names for the data, and proper dates for the two result tables.

    I also think your PLoan Commission count of 1 is wrong since the only Ploan record shows a 'N' in compliance.

    Regards
    Attached Files Attached Files
    Richard Buttrey

    RIP - d. 06/10/2022

    If any of the responses have helped then please consider rating them by clicking the small star icon below the post.

  3. #3
    Forum Contributor
    Join Date
    08-19-2006
    MS-Off Ver
    Excel 365
    Posts
    229

    Re: Populate Data Based on Multiple Criteria

    Hi Richard,

    Thank you so much for your reply

    Could you guide me how to use the dynamic name ranges? I know how to use normal name range but could you guide me how to use the dynamic name ranges ?

    In addition, appreciate your help if the following is possible for the sheet name "Number of Incidents By Outlet":

    Can I use a formula to populate the field in column "Incident Type", "Channel" and "Outlet/Kiosk", automatically for "Train Station" ? The reason being is I actually have to do a summary from Oct 2010 to Dec 2010 for all channels. Currently I am using custom filter to first filter for Oct 2010 to Dec 2010 and then manually filter by each incident type and channel, and then by each outlet. As you can imagine, the task is very time consuming since the actual list is long. Is this possible ?

  4. #4
    Forum Moderator - RIP Richard Buttrey's Avatar
    Join Date
    01-14-2008
    Location
    Stockton Heath, Cheshire, UK
    MS-Off Ver
    Office 365, Excel for Windows 2010 & Excel for Mac
    Posts
    29,464

    Re: Populate Data Based on Multiple Criteria

    Hi,

    Dynamic range names as you probably know are useful when you are adding new records to a database and wish to include the records in a range name.

    They use the standard OFFSET() function which takes four arguments, to define a range of cells. A cell (or range) reference and then four numbers. The first two define the upper left cell of the new range and are a) the number of rows to offset and b) the number of columns to offset. Having established the upper left cell, the third and fourth numbers define how tall and how wide the new range should be.

    So for instance in the range I named channel, the formula is

    =OFFSET('Data Table'!$D$5,0,0,COUNTA('Data Table'!$B:$B),1)

    Here D5 is the first cell in the data records channel column. The formula makes this an absolute reference with $D$5, and continues with ‘0,0’ which says don’t offset by any rows or columns, hence the upper left cell remains at D5.

    The COUNTA() function counts the number of non blank cells in a range, and hence in this formula they count the number of such cells in column B of the data table. i.e. the formula automatically expands the height of the defined name every time a new entry is made in column B. The final ‘,1’ simply says that the new range is 1 column wide, i.e. just column D.

    One point to note with these formulae where you are creating several names for ranges within the same database, is always to be consistent with the first bit of the COUNTA() function, i.e. the $B:$B in this example. Always choose a column which will always have a value on every row of the database. The reason is this. Some columns will not have values in every row and if you use these columns to count the number of rows in order to establish the height of the range it will not cover all the rows of the database.

    I wasn't quite sure what you meant by the second part about using a formula to populate a range since of course a formula will only return a single value, but I've assumed you mean that you want to filter a list of records from the database. You would do this with a Data Filter Advanced filter and specify the database and a criteria and output range. In the attached I've created three new names, 'Data', 'Data_Out' and 'Crit' and used these names in a macro which will do the data filter for you by clicking the blue button.

    HTH
    Attached Files Attached Files

  5. #5
    Forum Contributor
    Join Date
    08-19-2006
    MS-Off Ver
    Excel 365
    Posts
    229

    Re: Populate Data Based on Multiple Criteria

    Thank you Richard for taking the time to provide your explanation. I just wanted to say thank you for your valuable time and effort. Totally appreciate it !

+ 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