Primordial magnetic fields ( PMFs ) , which were generated in the early Universe before recombination , affect the motion of plasma and then the cosmic microwave background and the matter power spectrum . We consider constraints on PMFs with a characteristic correlation length from the observations of the anisotropies of the cosmic microwave background and the matter power spectrum . The spectrum of PMFs is modeled with multi-lognormal distributions , rather than power-law distribution , and we derive constraints on the strength | \mathbf { B } _ { k } | at each wave number k along with the standard cosmological parameters in the flat Universe and the foreground sources . We obtain upper bounds on the field strengths at k = 10 ^ { -1 } , 10 ^ { -2 } , 10 ^ { -4 } , and 10 ^ { -5 } Mpc ^ { -1 } as 4.7 nG , 2.1 nG , 5.3 nG , and 10.9 nG ( 2 \sigma C.L . ) respectively , while the field strength at k = 10 ^ { -3 } Mpc ^ { -1 } turns out to have a finite value as | \mathbf { B } _ { k = 10 ^ { -3 } } | = 6.2 \pm 1.3 nG ( 1 \sigma C.L . ) . This finite value is attributed to the finite values of BB mode data at \ell > 300 obtained from the QUAD experiment . If we do not include the BB mode data , we obtain only the upper bound on B _ { k = 10 ^ { -3 } } .