How to convert Third Octave data into single SPL quantity I have a data vector which consists of calibrated pressure at each sampled point in time. I have also taken this signal, applied a filter bank to it using a butterworth filter with passbands according to third octave (i.e. band center frequency at 25, 31.5, 40,...,20,000), and for each band calculated $20\log(p_{rms}/p_{ref})$ where $p_{rms}$ is the root mean squared pressure for the resulting filtered signal in each band, and $p_{ref} =2\times10^{-5}$ Pa. This should give me the third octave "spectrum".

I now wish to calculate the total sound pressure level (SPL). I thought first I could say that $SPL = 20\log(p/p_{ref})$ where $p$ is just the root mean squared value of the entire data vector. 

To compare I thought I would then calculate the same quantity but this time starting from my third octave data. I would then hope to get the same answer by adding logarithmically (i.e. adding the rms values from each band and then converting to dB) the dB values from each third octave band. However this did not give matching results.

I therefore suspect I am not converting from third octave to a single SPL quantity correctly, since my first calculation of SPL seems very straightforward. Am I missing something here? For instance does each third octave band need to be scaled by the frequency bin? This would imply I have some sort of density in third octave, but im not sure.
Make sure that you are trying to compare same quantities, i.e. not $SEL$ with $L_{eq,C}$.
If third-octave levels were not measured with any kind of weighting and you are trying to calculate $L_{eq,A}$ for example, then you must apply corrections.
For each band calculate the anti-logarithm using the formula: $p_i=10^{L_i/10}$ (for example for $54.3 \mathrm{dB}$ that would be $218776.2$).
Sum all values you obtained in previous step and calculate the total level as: $10\log_{10}\left(\sum p_i\right)$.


That will produce exact result - tested second ago on some data from SLM.