Count cells in the column that have the same first five characters in Excel

=SUM(IF(LEFT(A2,5)=LEFT(A3,5),1,0))

A2 = data cell 1; A3 = data cell 2

Check below for a detailed explanation with pictures and how to use formulas in Excel and Google Sheets.