I'm trying to count the number of unique values in a column if a certain name is present in another column.

Example:

Column A Column B
Joanna ECO60610
Joanna ECO60610
Joanna ECO60610
Ilona ECO56003
Sylwia ECO59237
Sylwia ECO59237
Sylwia ECO59237
Sylwia ECO59237
Sylwia ECO59237
Sylwia ECO59237
Marta ECO59824
Marta ECO59824
Ilona ECO60593
Ilona ECO59298

For Joanna, the result would be 1
For Ilona, the result would be 3
For Sylwia, the result would be 1
For Marta, the result would be 1

I've been using the following function for the unique values: =Sum(1/COUNTIF(B:B,B:B)) validated by Ctrl+Shift+Enter
The only way I could think of to do this is to split up the function by having an additional hidden column C with =SUM(1/COUNTIF(B:B,B#) and then in another cell, =SUMIFS(C#:C#,A#:A#,NAME)

Can anyone help with combining this into one function?

Thank you