How to sum units of repeating Code based on matching two criterias?
<p>Help!! I have a very large worksheet with thousands on rows with repeating information throughout it.  Column M lists project name.  Column N lists a specific numeric code.  Column P lists how many units of the code sold in a certain time frame. The dates are in Column L</p>

<p>I need to total the units for the codes if M=M (in the same project) AND N=N </p>

<p>I tried =IF(M2=M3,N2=N3,P2+P3) but there are times when there are three, four or even five instances when the codes repeat in a row.  </p>

<pre><code>L      M      N      P  results
1/2   red    2222    2     5
1/3   red    2222    3
1/2   red    4444    5     7
1/2   red    4444    2
1/4   red    3333    1     1
1/2   blue   2222    2     6
1/3   blue   2222    4
1/4   blue   4444    2     5
1/5   blue   4444    1
1/6   blue   4444    2
1/7   blue   3333    2    
</code></pre>

<p>If a code could be added to get rid of the duplicates under the total it would be wonderful.</p>

<p>Thank you for your help and courtesies in advance.</p>
