MS Excel INDEX, MATCH combined with COUNTIF

Anonymous
2020-03-19T06:49:40+00:00

Hello, I am trying to calculate data from another sheet based on some criteria. I want to search and match the name of the first list with a second one in another sheet, then from the second list (which is Table)

I have 2 sheets, first one has the annual Dashboard of all employees (365 days) and there are symbols that separates type of leave, for example U is unpaid or S is sick etc, the second is a table, with employees names at the first column and in the rest columns are vacation types, (Column2 = Unpaid, Column3 = Sick etc) and I want to count per employee and per vacation type their leaves. Finaly I want on the second sheet to contain my company's employees name and the totals of every vacation type.

So, I tried using INDEX and MATCH to find employee and with a simple IF function (cause the 2 tables are identically) was easy to bring the final count.

But, after this video ( https://www.youtube.com/watch?v=fDB1Ktyhp3Y ) I tried to make a Drop down list with our company's Departments and when I select the department filters the first column and shows me only selected department's employees, but, the count function did never work.

I will appreciate your help on this. Thank you very much.

Here is a picture of my project, it is in Greek but I added some comments to help.

Microsoft 365 and Office | Excel | For home | Windows

Locked Question. This question was migrated from the Microsoft Support Community. You can vote on whether it's helpful, but you can't add comments or replies or follow the question.

0 comments No comments
{count} votes
Answer accepted by question author
  1. Anonymous
    2020-03-20T16:30:16+00:00

    Everything can be dynamic - height, width, the offsets. You can also use INDEX - which has an odd usage, like this, with that hanging comma at the end to use all the columns of the range:

    =COUNTIF(INDEX(DASHBOARD!$B$5:$$ZZ$1000,MATCH(C6,DASHBOARD!$B$5:$B$10000,FALSE),),"K")

    And if you are afraid of row insertions between 4 and 5, you can offset from B5 and subtract 1 from the MATCH return....

    3 people found this answer helpful.
    0 comments No comments
Answer accepted by question author
  1. Anonymous
    2020-03-19T15:33:03+00:00

    I would use a formula like this, with names starting in cell B5 of DASHBOARD:

    =COUNTIF(OFFSET(DASHBOARD!$B$4,MATCH(C6,DASHBOARD!$B$5:$B$10000,FALSE),0,1,366),"K")

    2 people found this answer helpful.
    0 comments No comments

5 additional answers

Sort by: Most helpful
  1. Anonymous
    2020-03-22T16:53:31+00:00

    The weird thing with comma at the end of INDEX we use to say the formula, look all the columns in the given range? Otherwise, it returns #REF. If I delete comma what does it search?

    So, in sheet DASHBOARD my range is a Table called T_DASHBOARD and I turn yours formula to this : COUNTIF(INDEX(T_DASHBOARD;MATCH(C6;T_DASHBOARD[[#All];[Column367]];FALSE););"Κ").

    It works!

    Thank you!

    0 comments No comments
  2. Anonymous
    2020-03-22T17:39:42+00:00

    Great! It's always nice to have multiple options...

    0 comments No comments