Hi and welcome. It depends. If your independent variable is binary, then yes, it makes sort of sense to use the Pearson correlation (which is also called a point-biserial correlation). Depending on what you want, a t-test might make more sense. See the thread

here. CORREL is the function you want.

If your independent variable is non-binary and nominal, then correlation makes no sense. See

here.

A categorical variable is a nominal variable. But if you meant an ordinal variable, then you can do a Spearman's correlation. Excel doesn't have a built-in function, but since Spearman is just Pearson with ranks, you can do it

this way.