Closed Thread
Results 1 to 15 of 15

Help with Formula for COUNTIIFS INDEX MATCH Multiple Criteria Same Column

  1. #1
    Forum Contributor
    Join Date
    10-05-2010
    Location
    CA
    MS-Off Ver
    Excel 365
    Posts
    539

    Question Help with Formula for COUNTIIFS INDEX MATCH Multiple Criteria Same Column

    Hello,
    I have a COUNTIFS INDEX MATCH formula that matches the header in a column and then counts the number of times a certain value appears in that column.The initial portion of the formula matches results between a certain date and time. I want to update the formula so that it can count multiple values in the same column in an IF/OR fashion. There are several different headers and values, so the formula must be flexible enough to multiple possible combinations.

    E3:E4 - Contains the formulas. Each matching is based on a color criteria.
    C3:C4 - Contains the color criteria to match.
    B3:B6 - Contains dates and times for the formula to look between.
    A7:A14 - Contains the headers.
    B7:F14 - Contains the values.
    A16:F120 - Contains the data being searched.

    Please Login or Register  to view this content.
    For example:
    A7 contains the header being match (States) and B7 contains the value (TX). The formula matches the header in A16:K16, which is C16, and counts the number of times the value (TX) appears in C17:C120. It then proceeds to check the rest of B7:B14 for values to match.

    I want to be able to add additional values to MATCH in an IF/OR fashion. So, if any of the values listed are found the value is counted.

    See the spreadsheet attached for example.

    Thank you in advance for any and all help.
    Attached Files Attached Files
    Last edited by artiststevens; 09-23-2023 at 07:08 PM.

  2. #2
    Forum Expert XLent's Avatar
    Join Date
    10-13-2010
    Location
    Northumberland, UK
    MS-Off Ver
    various
    Posts
    2,704

    Re: Help with Formula for COUNTIIFS INDEX MATCH Multiple Criteria Same Column

    if I've understood, and that you are using O365, one option (adhering to your "flexible" approach w.r.t column positions other than Dates / Colour)

    Formula: copy to clipboard
    Please Login or Register  to view this content.
    if the column positions don't move, i.e. Cities will always appear in Column D, use fixed references.
    the above applies an initial filter to the data, using dates & colour, before applying the "searches" of variant criteria
    Last edited by XLent; 09-19-2023 at 05:38 AM.

  3. #3
    Forum Guru HansDouwe's Avatar
    Join Date
    06-21-2022
    Location
    Nederland
    MS-Off Ver
    365 V2403 (Build 17330.20000)
    Posts
    6,428

    Re: Help with Formula for COUNTIIFS INDEX MATCH Multiple Criteria Same Column

    Here is another option (both values in one formula):

    Please empty all cells with "<>" and empty cell E4 and try in E3:
    Please Login or Register  to view this content.
    By the way: In your sample sheet in Post #1 is the formule in F4, count of (TX, Spanish, 3) not correct. There are 3 matches, but the formula in F4 retruns 0.
    Attached Files Attached Files
    Last edited by HansDouwe; 09-19-2023 at 08:58 AM.

  4. #4
    Forum Contributor
    Join Date
    10-05-2010
    Location
    CA
    MS-Off Ver
    Excel 365
    Posts
    539

    Question Re: Help with Formula for COUNTIIFS INDEX MATCH Multiple Criteria Same Column

    Apologies for the late reply and thank you both for your input, it is greatly appreciated.

    Both examples achieved what I needed but since the references are not fixed, I opted to go with the solution by HansDouwe. Also Hans, you were correct about the error. Thank you for finding that as well.

    I do have an additional question/update. I moved the data to a separate tab and updated the formula. I added columns to the Example tab which breaks down the count for each header and value separately.

    Hans, I need the formula you created to be updated to drill down to get the specific count for each header and value.

    An updated spreadsheet is attached with examples.

    Thank you again for all your help. It is greatly appreciated.
    Attached Files Attached Files

  5. #5
    Forum Guru HansDouwe's Avatar
    Join Date
    06-21-2022
    Location
    Nederland
    MS-Off Ver
    365 V2403 (Build 17330.20000)
    Posts
    6,428

    Re: Help with Formula for COUNTIIFS INDEX MATCH Multiple Criteria Same Column

    Thanks for the feedback and rep. Glad to have helped and it was a nice question to solve. .

    This dynamic formula in cell H17 returns the whole table (including the headers) in one go.
    Only the data with a total of 0 will not be displayed.

    Is that acceptable?

    If not, please let us know, the formula will need to be thoroughly adjusted.

    Please try:
    Please Login or Register  to view this content.
    Attached Files Attached Files
    Last edited by HansDouwe; 09-21-2023 at 09:04 AM.

  6. #6
    Forum Contributor
    Join Date
    10-05-2010
    Location
    CA
    MS-Off Ver
    Excel 365
    Posts
    539

    Question Re: Help with Formula for COUNTIIFS INDEX MATCH Multiple Criteria Same Column

    You're welcome! Thank you for the help and your time.

    The problem with the dynamic formula is that it doesn't transfer well from example sheet to the actual sheet.

    I need something I can edit and update more easily if that is possible.

    I attached another spreadsheet with a snippet of the actual data, values, and headings. (see tabs Data(2) and Example(2)) The format and setup are exactly the same.

    The data is on the Data(2) tab G:BD and the result is in BE.

    Thank you again for all your help. It is greatly appreciated.
    Attached Files Attached Files
    Last edited by artiststevens; 09-21-2023 at 11:45 PM.

  7. #7
    Forum Guru HansDouwe's Avatar
    Join Date
    06-21-2022
    Location
    Nederland
    MS-Off Ver
    365 V2403 (Build 17330.20000)
    Posts
    6,428

    Re: Help with Formula for COUNTIIFS INDEX MATCH Multiple Criteria Same Column

    The formula is working perfect in your actual sheet.

    All you have to do is adjust the references:

    Please Login or Register  to view this content.
    Attached Files Attached Files
    Last edited by HansDouwe; 09-22-2023 at 02:04 AM.

  8. #8
    Forum Guru HansDouwe's Avatar
    Join Date
    06-21-2022
    Location
    Nederland
    MS-Off Ver
    365 V2403 (Build 17330.20000)
    Posts
    6,428

    Re: Help with Formula for COUNTIIFS INDEX MATCH Multiple Criteria Same Column

    With a very small change it is possible to SORT the indicators:

    Please Login or Register  to view this content.
    Attached Files Attached Files

  9. #9
    Forum Contributor
    Join Date
    10-05-2010
    Location
    CA
    MS-Off Ver
    Excel 365
    Posts
    539

    Question Re: Help with Formula for COUNTIIFS INDEX MATCH Multiple Criteria Same Column

    This is exactly what I needed! Thank you again! One more thing though, could you update the formula for the overall PnL? I am unable to adjust the new formula to make it work. Thank you.
    Attached Images Attached Images

  10. #10
    Forum Guru HansDouwe's Avatar
    Join Date
    06-21-2022
    Location
    Nederland
    MS-Off Ver
    365 V2403 (Build 17330.20000)
    Posts
    6,428

    Re: Help with Formula for COUNTIIFS INDEX MATCH Multiple Criteria Same Column

    Please empty cells E2:F4 and try in E2:
    Please Login or Register  to view this content.
    Attached Files Attached Files

  11. #11
    Forum Contributor
    Join Date
    10-05-2010
    Location
    CA
    MS-Off Ver
    Excel 365
    Posts
    539

    Re: Help with Formula for COUNTIIFS INDEX MATCH Multiple Criteria Same Column

    That works perfectly! Thank you again!

  12. #12
    Forum Guru HansDouwe's Avatar
    Join Date
    06-21-2022
    Location
    Nederland
    MS-Off Ver
    365 V2403 (Build 17330.20000)
    Posts
    6,428

    Re: Help with Formula for COUNTIIFS INDEX MATCH Multiple Criteria Same Column

    You are Welcome!

    Thanks for the feedback and glad to have helped. .

    If you haven't already, please consider adding reputation to all helpers you think they deserve.
    In that case please click * Add Reputation left below their answers.

  13. #13
    Forum Contributor
    Join Date
    10-05-2010
    Location
    CA
    MS-Off Ver
    Excel 365
    Posts
    539

    Question Help with Formula for COUNTIIFS INDEX MATCH Multiple Criteria Same Column

    Hello,
    I have a COUNTIFS INDEX MATCH formula that matches the header in a column and then counts the number of times a certain value appears in that column. I was able to get help here previously with changes and additions. I am hoping someone can help me with more updates and changes.

    Previous post:
    Please Login or Register  to view this content.
    Thank you in advance.
    Attached Files Attached Files

  14. #14
    Forum Contributor
    Join Date
    10-05-2010
    Location
    CA
    MS-Off Ver
    Excel 365
    Posts
    539

    Question Re: Help with Formula for COUNTIIFS INDEX MATCH Multiple Criteria Same Column

    Hello,
    I received help with this problem before and the solution worked perfectly but I am reopening this thread to receive additional help with revising and updating the formula.

    Below is the main formula used that I would like edited to fit my current needs. The formula is on sheet 'Example(2)'!E2 and filters for the data in the sheet 'Data(2)'! based upon the entries in the table on sheet 'Example(2)'A1:F14.

    The formula in 'Example(2)'!E2 creates a table that gives the count based upon the criteria in C2, C3, the total of both criteria, and there percentages of the totals.

    I want to keep the general framework of the formula with an additional criterion to be added based upon which cell the formula is in. Making some adjustments to the formula to breakdown more data in a second table 'Example(2)'!H1:K14

    Framework I want to keep:
    Please Login or Register  to view this content.
    Formulas Needed:
    I4: The SUM amount of column 'Data(2)'!CS of values where Criteria 1 and 2 are met.
    Criteria 1: Using the same framework and criteria as the formula in 'Example(2)'!E2 (see above)
    Criteria 2: Filter for rows where 'Data(2)'!CQ = "Profit"

    I5: The SUM amount of column 'Data(2)'!CS of values where Criteria 1 and 2 are met.
    Criteria 1: Using the same framework and criteria as the formula in 'Example(2)'!E2 (see above)
    Criteria 2: Filter for rows where 'Data(2)'!CQ = "Loss"

    I7: The MIN value from column 'Data(2)'!CO where Criteria 1 and 2 are met.
    Criteria 1: Using the same framework and criteria as the formula in 'Example(2)'!E2 (see above)
    Criteria 2: Filter for rows where 'Data(2)'!CQ = "Profit"

    K3: The AVG number from column 'Data(2)'!CR where Criteria 1 is met.
    Criteria 1: Using the same framework and criteria as the formula in 'Example(2)'!E2 (see above)

    K4: The AVG number from column 'Data(2)'!CR where Criteria 1 and 2 are met.
    Criteria 1: Using the same framework and criteria as the formula in 'Example(2)'!E2 (see above)
    Criteria 2: Filter for rows where 'Data(2)'!CQ = "Profit"

    K5: The AVG number from column 'Data(2)'!CR where Criteria 1 and 2 are met.
    Criteria 1: Using the same framework and criteria as the formula in 'Example(2)'!E2 (see above)
    Criteria 2: Filter for rows where 'Data(2)'!CQ = "Loss"

    K8: The MAX number of times the value "Profit" appears "consecutively" in column 'Data(2)'!CQ
    Criteria: Using the same framework and criteria as the formula in 'Example(2)'!E2 (see above)

    K9: The MIN number of times the value "Loss" appears "consecutively" in column 'Data(2)'!CQ
    Criteria: Using the same framework and criteria as the formula in 'Example(2)'!E2 (see above)

    K10: The MAX value in column 'Data(2)'!CN
    Criteria: Using the same framework and criteria as the formula in 'Example(2)'!E2 (see above). All values. Both "profit" and "loss".

    K11: The MIN value in column 'Data(2)'!CO
    Criteria: Using the same framework and criteria as the formula in 'Example(2)'!E2 (see above). All values. Both "profit" and "loss".

    K14: The AVG number from column 'Data(2)'!CG
    Criteria: Using the same framework and criteria as the formula in 'Example(2)'!E2 (see above). All values. Both "profit" and "loss".

    See the spreadsheet attached for example.

    I appreciate your responses.
    Attached Files Attached Files

  15. #15
    Forum Moderator AliGW's Avatar
    Join Date
    08-10-2013
    Location
    Retired in Ipswich, Suffolk, but grew up in Sawley, Derbyshire (England)
    MS-Off Ver
    MS 365 Subscription Insider Beta Channel v. 2404 (Windows 11 22H2 64-bit)
    Posts
    80,853

    Re: Help with Formula for COUNTIIFS INDEX MATCH Multiple Criteria Same Column

    Closed in favour of the new thread in Commercial Services: https://www.excelforum.com/commercia...s-updates.html
    Ali


    Enthusiastic self-taught user of MS Excel who's always learning!
    Don't forget to say "thank you" in your thread to anyone who has offered you help.
    You can reward them by clicking on * Add Reputation below their user name on the left, if you wish.

    Forum Rules (updated August 2023): please read them here.

Closed Thread

Thread Information

Users Browsing this Thread

There are currently 1 users browsing this thread. (0 members and 1 guests)

Similar Threads

  1. [SOLVED] Can't get index match (with multiple row and column criteria) to work
    By tml2424 in forum Excel Formulas & Functions
    Replies: 9
    Last Post: 08-18-2020, 09:40 PM
  2. Replies: 6
    Last Post: 12-13-2017, 10:08 AM
  3. [SOLVED] Index Match with Multiple Criteria Using Same Criteria Column
    By rominjn in forum Excel Formulas & Functions
    Replies: 4
    Last Post: 08-05-2015, 11:34 AM
  4. Replies: 7
    Last Post: 07-26-2015, 04:02 PM
  5. [SOLVED] Index/Match Formula - multiple criteria in one column
    By davemon in forum Excel Formulas & Functions
    Replies: 13
    Last Post: 12-19-2014, 03:00 PM
  6. Replies: 2
    Last Post: 09-27-2014, 04:34 PM
  7. [SOLVED] Vlookup or index/match with multiple column and criteria?
    By xirx in forum Excel General
    Replies: 2
    Last Post: 07-22-2005, 08:05 AM

Tags for this Thread

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