A family of Microsoft spreadsheet software with tools for analyzing, charting, and communicating data
If you have Microsoft 365 or Office 2021, you can use a formula such as
=COUNTA(UNIQUE(A2:A6))
In older versions you can use a formula such as
=SUMPRODUCT(1/COUNTIF(A2:A6,A2:A6))
(You may have to confirm the formula with Ctrl+Shift+Enter)