I think that the best way to understand the formula is to divide it into parts. Look at this:
Note: I used the SUBTOTAL function and not only the SUM to sum the array created with the function OFFSET because only SUBTOTAL function do this job.
<b>Excel 2007</b><table cellpadding="2.5px" rules="all" style=";background-color: #FFFFFF;border: 1px solid;border-collapse: collapse; border-color: #A6AAB6"><colgroup><col width="25px" style="background-color: #E0E0F0" /><col /><col /><col /><col /><col /><col /><col /><col /></colgroup><thead><tr style=" background-color: #E0E0F0;text-align: center;color: #161120"><th></th><th>A</th><th>B</th><th>C</th><th>D</th><th>F</th><th>G</th><th>I</th><th>J</th></tr></thead><tbody><tr ><td style="color: #161120;text-align: center;">5</td><td style="font-weight: bold;text-align: center;;">Col01</td><td style="font-weight: bold;text-align: center;;">Col02</td><td style="text-align: center;;"></td><td style="font-weight: bold;text-align: center;background-color: #C5D9F1;;">Result</td><td style="font-weight: bold;text-align: center;;">Cod</td><td style="font-weight: bold;text-align: center;;">Value</td><td style="font-weight: bold;text-align: center;;">Parts of the formula</td><td style="font-weight: bold;text-align: center;;">Results</td></tr><tr ><td style="color: #161120;text-align: center;">6</td><td style="text-align: center;;">Manager</td><td style="text-align: center;;">P</td><td style="text-align: center;;">Manager</td><td style="text-align: center;background-color: #C5D9F1;;">2</td><td style="text-align: center;;">P</td><td style="text-align: center;;">0</td><td style="text-align: center;background-color: #C5D9F1;;">=IF(A6:A16=C6,B6:B16,0)</td><td style="text-align: center;background-color: #C5D9F1;;">{"P";"10 to 7";1;0;0;0;0;0;0;0;0}</td></tr><tr ><td style="color: #161120;text-align: center;">7</td><td style="text-align: center;;">Manager</td><td style="text-align: center;;">10 to 7</td><td style="text-align: right;;"></td><td style="text-align: right;;"></td><td style="text-align: center;;">10 to 7</td><td style="text-align: center;;">1</td><td style="text-align: center;background-color: #C5D9F1;;">=MATCH(IF(A6:A16=C6,B6:B16,0),F6:F10,0)</td><td style="text-align: center;background-color: #C5D9F1;;">{1;2;3;#N/D;#N/D;#N/D;#N/D;#N/D;#N/D;#N/D;#N/D}</td></tr><tr ><td style="color: #161120;text-align: center;">8</td><td style="text-align: center;;">Manager</td><td style="text-align: center;;">1</td><td style="text-align: center;;"></td><td style="text-align: right;;"></td><td style="text-align: center;;">1</td><td style="text-align: center;;">1</td><td style="text-align: center;background-color: #C5D9F1;;">=IF(A6:A16=C6,MATCH(IF(A6:A16=C6,B6:B16,0),F6:F10,0))-1</td><td style="text-align: center;background-color: #C5D9F1;;">{0;1;2;-1;-1;-1;-1;-1;-1;-1;-1}</td></tr><tr ><td style="color: #161120;text-align: center;">9</td><td style="text-align: center;;">Sales</td><td style="text-align: center;;">XB</td><td style="text-align: center;;"></td><td style="text-align: center;;"></td><td style="text-align: center;;">XB</td><td style="text-align: center;;">0</td><td style="text-align: center;background-color: #C5D9F1;;">=OFFSET(G6,TRANSPOSE(IF(A6:A16=C6,MATCH(IF(A6:A16=C6,B6:B16,0),F6:F10,0))-1),0)</td><td style="text-align: center;background-color: #C5D9F1;;">{0\1\1\"Value"\"Value"\"Value"\"Value"\"Value"\"Value"\"Value"\"Value"}</td></tr><tr ><td style="color: #161120;text-align: center;">10</td><td style="text-align: center;;">Sales</td><td style="text-align: center;;">10 to 7</td><td style="text-align: center;;"></td><td style="text-align: center;;"></td><td style="text-align: center;;">X</td><td style="text-align: center;;">0</td><td style="text-align: center;background-color: #C5D9F1;;">=SUBTOTAL(9,OFFSET(G6,TRANSPOSE(IF(A6:A16=C6,MATCH(IF(A6:A16=C6,B6:B16,0),F6:F10,0))-1),0))</td><td style="text-align: center;background-color: #C5D9F1;;">{0\1\1\0\0\0\0\0\0\0\0}</td></tr><tr ><td style="color: #161120;text-align: center;">11</td><td style="text-align: center;;">Sales</td><td style="text-align: center;;">1</td><td style="text-align: center;;"></td><td style="text-align: center;;"></td><td style="text-align: center;;"></td><td style="text-align: right;;"></td><td style="text-align: center;background-color: #C5D9F1;;">=SUM(SUBTOTAL(9,OFFSET(G6,TRANSPOSE(IF(A6:A16=C6,MATCH(IF(A6:A16=C6,B6:B16,0),F6:F10,0))-1),0)))</td><td style="text-align: center;background-color: #C5D9F1;;">SUM({0\1\1\0\0\0\0\0\0\0\0})</td></tr><tr ><td style="color: #161120;text-align: center;">12</td><td style="text-align: center;;">Sales</td><td style="text-align: center;;">1</td><td style="text-align: center;;"></td><td style="text-align: center;;"></td><td style="text-align: center;;"></td><td style="text-align: center;;"></td><td style="text-align: center;;"></td><td style="text-align: center;;"></td></tr><tr ><td style="color: #161120;text-align: center;">13</td><td style="text-align: center;;">Sales</td><td style="text-align: center;;">10 to 7</td><td style="text-align: center;;"></td><td style="text-align: center;;"></td><td style="text-align: center;;"></td><td style="text-align: center;;"></td><td style="text-align: center;;"></td><td style="text-align: center;;"></td></tr><tr ><td style="color: #161120;text-align: center;">14</td><td style="text-align: center;;">Sales</td><td style="text-align: center;;">1</td><td style="text-align: center;;"></td><td style="text-align: center;;"></td><td style="text-align: center;;"></td><td style="text-align: center;;"></td><td style="text-align: center;;"></td><td style="text-align: center;;"></td></tr><tr ><td style="color: #161120;text-align: center;">15</td><td style="text-align: center;;">Sales</td><td style="text-align: center;;">1</td><td style="text-align: center;;"></td><td style="text-align: center;;"></td><td style="text-align: center;;"></td><td style="text-align: center;;"></td><td style="text-align: center;;"></td><td style="text-align: center;;"></td></tr><tr ><td style="color: #161120;text-align: center;">16</td><td style="text-align: center;;">Sales</td><td style="text-align: center;;">X</td><td style="text-align: center;;"></td><td style="text-align: center;;"></td><td style="text-align: center;;"></td><td style="text-align: center;;"></td><td style="text-align: center;;"></td><td style="text-align: center;;"></td></tr><tr ><td style="color: #161120;text-align: center;">17</td><td style="text-align: center;;"></td><td style="text-align: center;;"></td><td style="text-align: center;;"></td><td style="text-align: center;;"></td><td style="text-align: center;;"></td><td style="text-align: center;;"></td><td style="text-align: center;;"></td><td style="text-align: center;;"></td></tr><tr ><td style="color: #161120;text-align: center;">18</td><td style="text-align: center;;">*****</td><td style="text-align: center;;">*****</td><td style="text-align: center;;">*****</td><td style="text-align: center;;">*****</td><td style="text-align: center;;">*****</td><td style="text-align: center;;">*****</td><td style="text-align: center;;">*****</td><td style="text-align: center;;">*****</td></tr></tbody></table><p style="width:3.6em;font-weight:bold;margin:0;padding:0.2em 0.6em 0.2em 0.5em;border: 1px solid #A6AAB6;border-top:none;text-align: center;background-color: #E0E0F0;color: #161120">Sheet3</p><br /><br /><table width="85%" cellpadding="2.5px" rules="all" style=";border: 2px solid black;border-collapse:collapse;padding: 0.4em;background-color: #FFFFFF" ><tr><td style="padding:6px" ><b>Array Formulas</b><table cellpadding="2.5px" width="100%" rules="all" style="border: 1px solid;text-align:center;background-color: #FFFFFF;border-collapse: collapse; border-color: #A6AAB6"><thead><tr style=" background-color: #E0E0F0;color: #161120"><th width="10px">Cell</th><th style="text-align:left;padding-left:5px;">Formula</th></tr></thead><tbody><tr><th width="10px" style=" background-color: #E0E0F0;color: #161120">D6</th><td style="text-align:left">{=SUM(<font color="Blue">SUBTOTAL(<font color="Red">9,OFFSET(<font color="Green">G6,TRANSPOSE(<font color="Purple">IF(<font color="Teal">A6:A16=C6,MATCH(<font color="#FF00FF">IF(<font color="Navy">A6:A16=C6,B6:B16,0</font>),F6:F10,0</font>)</font>)-1</font>),0</font>)</font>)</font>)}</td></tr></tbody></table><b>Entered with Ctrl+Shift+Enter.</b> If entered correctly, Excel will surround with curly braces {}.
<b>Note: Do not try and enter the {} manually yourself</b></td></tr></table><br />
I hope this help you to understand the formula.
Markmzz