In most counting scenarios in Excel, COUNTBLANK reliably counts blank cells, and COUNTA reliably counts populated cells.
Don’t copy and paste the same code over and over again. Instead, create a PowerShell function and save yourself time.