Trying to =COUNTIF when another cell matches criteria

I'm trying to Count the number of times Column B contains X when Column A contains Y.

For example: Column A is a list of colors (Red, Blue, Green, etc) and Column B contains multiple names in each cell (Matt, Joe, Paul, etc).

I want to count how many times Column B contains "Matt" only when Column A meets criteria of "Red". If Column A3 contains Blue, I don't want to look in B3 for "Matt". What I'm looking for in the end is the total number of times that "Matt" is displayed in B:B whenever A:A=Red.

COUNTIFS

Hi
what you need is COUNTIFS for example

COUNTIFS(B5,"matt",A5,"red")

hope this helps

Leigh