We study how the interaction between the streaming instability and intrinsic gas-phase turbulence affects planetesimal formation via gravitational collapse in protoplanetary disks. Turbulence impedes the formation of particle clumps by acting as an effective turbulent diffusivity, but it can also promote planetesimal formation by concentrating solids, for example in zonal flows. We quantify the effect of turbulent diffusivity using numerical simulations of the streaming instability in small local domains, forced with velocity perturbations that establish approximately Kolmogorov-like turbulence. We find that planetesimal formation is suppressed by turbulence once velocity fluctuations exceed $langle delta v^2 rangle simeq 10^{-3.5} - 10^{-3} c_s^2$. Turbulence whose strength is just below the threshold reduces the rate at which solids are bound into clumps. Our results suggest that the well-established turbulent thickening of the mid-plane solid layer is the primary mechanism by which turbulence influences planetesimal formation and that planetesimal formation requires a mid-plane solid-to-gas ratio $epsilon gtrsim 0.5$. We also quantify the initial planetesimal mass function using a new clump-tracking method to determine each planetesimal mass shortly after collapse. For models in which planetesimals form, we show that the mass function is well-described by a broken power law, whose parameters are robust to the inclusion and strength of imposed turbulence. Turbulence in protoplanetary disks is likely to substantially exceed the threshold for planetesimal formation at radii where temperatures $T gtrsim 10^3 {rm K}$ lead to thermal ionization. Planetesimal formation may therefore be unviable in the inner disk out to 2-3 times the dust sublimation radius.