Given a bounded measurable function σ on Rn, we let Tσ be the operator obtained by multiplication on the Fourier transform by σ. Let 0<s1≤s2≤⋯≤sn<1 and ψ be a Schwartz function on the real line whose Fourier transform ψˆ is supported in [−2,−1/2]∪[1/2,2] and which satisfies ∑j∈Zψˆ(2−jξ)=1 for all ξ≠0. In this work we provide a sharp form of the Marcinkiewicz multiplier theorem on Lp by finding an almost optimal function space with the property that, if the function(ξ1,…,ξn)↦∏i=1n(I−∂i2)si2[∏i=1nψˆ(ξi)σ(2j1ξ1,…,2jnξn)] belongs to it uniformly in j1,…,jn∈Z, then Tσ is bounded on Lp(Rn) when |1p−12|<s1 and 1<p<∞. In the case where si≠si+1 for all i, it was proved in [12] that the Lorentz space L1s1,1(Rn) is the function space sought. Here we address the significantly more difficult general case when for certain indices i we might have si=si+1. We obtain a version of the Marcinkiewicz multiplier theorem in which the space L1s1,1 is replaced by an appropriate Lorentz space associated with a certain concave function related to the number of terms among s2,…,sn that equal s1. Our result is optimal up to an arbitrarily small power of the logarithm in the defining concave function of the Lorentz space.