A method is provided for the discrimination of cells from other particles, as well as of different types of cells in raw milk samples by impedance microflow cytometry. A method is provided of analysing the quality of raw milk in terms of its bacterial and somatic cell content without the need to pre-treat the milk sample, such that the analysis can take place directly at the production site. One advantage is discriminating and counting somatic cells from milk particles (consisting mainly of lipid vesicles) by high-frequency impedance analysis directly performed on untreated raw milk. Another advantage is that the method allows diagnosing the status of a mastitis infection directly after milking according to the analysis of the somatic cell count. Another advantage is to allow a fast method for determining the bacterial cell count in raw milk directly after milking. In addition, viability of both somatic and bacterial cells can be determined without the need of any cell label. A further advantage is, that the analysis can be obtained in real-time, directly after the raw milk has passed the micro channel of the microfluidic device.