We have measured the effect of bacteria adsorption on the resonant frequency of microcantilevers as a function of the adsorption position and vibration mode. The resonant frequencies were measured from the Brownian fluctuations of the cantilever tip. We found that the sign and amount of the resonant frequency change is determined by the position and extent of the adsorption on the cantilever with regard to the shape of the vibration mode. To explain these results, a theoretical one-dimensional model is proposed. We obtain analytical expressions for the resonant frequency that accurately fit the data obtained by the finite element method. More importantly, the theory data shows a good agreement with the experiments. Our results indicate that there exist two opposite mechanisms that can produce a significant resonant frequency shift: the stiffness and the mass of the bacterial cells. Based on the thermomechanical noise, we analyse the regions of the cantilever of lowest and highest sensitivity to the attachment of bacteria. The combination of high vibration modes and the confinement of the adsorption to defined regions of the cantilever allows the detection of single bacterial cells by only measuring the Brownian fluctuations. This study can be extended to smaller cantilevers and other biological systems such as proteins and nucleic acids.