Excel 2010 doesn't seem to be adding properly

baseball

Board Regular
Joined
Apr 1, 2002
Messages
153
The excerpt from the sheet shows the problem in the HA_Nr column where I am trying to number runs of H's and A's in the HA column. If D3 = D2 AND I3 = I2, then I increment the value. When the AND is not true, then the counter resets. IF(AND(C7=C6,E7=E6),H6+1,1) As can be seen in row 7, HA_Nr was decremented instead of incremented and I do not understand. This also occurs in the cells marked in bold red. Am I missing something or is Excel ?
Excel Workbook
CDEHIJ
1TeamOppHASeriesNrHA_NrShould be
2BOSWS1A111
3BOSWS1A222
4BOSPHAH111
5BOSPHAH222
6BOSWS1H133
7BOSWS1H224
8BOSNYAH135
9BOSPHAA111
10BOSPHAA222
11BOSPHAA333
12BOSCHAH111
13BOSCHAH222
14BOSSLAH133
15BOSSLAH224
16BOSCLEH135
17BOSCLEH226
18BOSCLEH337
19BOSDETH148
20BOSDETH229
21BOSNYAA111
22BOSNYAA222
23BOSNYAA333
24BOSCHAA144
25BOSSLAA125
26BOSDETA126
27BOSDETA227
28BOSCLEA138
29BOSNYAH111
30BOSPHAA111
Home_Road
Excel 2010
Cell Formulas
RangeFormula
I3=IF(AND(C3=C2,E3=E2),H2+1,1)
I4=IF(AND(C4=C3,E4=E3),H3+1,1)
I5=IF(AND(C5=C4,E5=E4),H4+1,1)
I6=IF(AND(C6=C5,E6=E5),H5+1,1)
I7=IF(AND(C7=C6,E7=E6),H6+1,1)
I8=IF(AND(C8=C7,E8=E7),H7+1,1)
I9=IF(AND(C9=C8,E9=E8),H8+1,1)
I10=IF(AND(C10=C9,E10=E9),H9+1,1)
I11=IF(AND(C11=C10,E11=E10),H10+1,1)
I12=IF(AND(C12=C11,E12=E11),H11+1,1)
I13=IF(AND(C13=C12,E13=E12),H12+1,1)
I14=IF(AND(C14=C13,E14=E13),H13+1,1)
I15=IF(AND(C15=C14,E15=E14),H14+1,1)
I16=IF(AND(C16=C15,E16=E15),H15+1,1)
I17=IF(AND(C17=C16,E17=E16),H16+1,1)
I18=IF(AND(C18=C17,E18=E17),H17+1,1)
I19=IF(AND(C19=C18,E19=E18),H18+1,1)
I20=IF(AND(C20=C19,E20=E19),H19+1,1)
I21=IF(AND(C21=C20,E21=E20),H20+1,1)
I22=IF(AND(C22=C21,E22=E21),H21+1,1)
I23=IF(AND(C23=C22,E23=E22),H22+1,1)
I24=IF(AND(C24=C23,E24=E23),H23+1,1)
I25=IF(AND(C25=C24,E25=E24),H24+1,1)
I26=IF(AND(C26=C25,E26=E25),H25+1,1)
I27=IF(AND(C27=C26,E27=E26),H26+1,1)
I28=IF(AND(C28=C27,E28=E27),H27+1,1)
I29=IF(AND(C29=C28,E29=E28),H28+1,1)
I30=IF(AND(C30=C29,E30=E29),H29+1,1)
 

Excel Facts

Bring active cell back into view
Start at A1 and select to A9999 while writing a formula, you can't see A1 anymore. Press Ctrl+Backspace to bring active cell into view.
Look at this (in blue):

=IF((C1=C2)*(E1=E2),I1+1,1)

<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 /></colgroup><thead><tr style=" background-color: #E0E0F0;text-align: center;color: #161120"><th></th><th>C</th><th>D</th><th>E</th><th>H</th><th>I</th></tr></thead><tbody><tr ><td style="color: #161120;text-align: center;">1</td><td style="text-align: center;;">Team</td><td style="text-align: center;;">Opp</td><td style="text-align: center;;">HA</td><td style="text-align: center;;">SeriesNr</td><td style="text-align: center;;">HA_Nr</td></tr><tr ><td style="color: #161120;text-align: center;">2</td><td style="text-align: center;;">BOS</td><td style="text-align: center;;">WS1</td><td style="text-align: center;;">A</td><td style="text-align: center;;">1</td><td style="text-align: center;;">1</td></tr><tr ><td style="color: #161120;text-align: center;">3</td><td style="text-align: center;;">BOS</td><td style="text-align: center;;">WS1</td><td style="text-align: center;;">A</td><td style="text-align: center;;">2</td><td style="text-align: center;;">2</td></tr><tr ><td style="color: #161120;text-align: center;">4</td><td style="text-align: center;;">BOS</td><td style="text-align: center;;">PHA</td><td style="text-align: center;;">H</td><td style="text-align: center;;">1</td><td style="text-align: center;;">1</td></tr><tr ><td style="color: #161120;text-align: center;">5</td><td style="text-align: center;;">BOS</td><td style="text-align: center;;">PHA</td><td style="text-align: center;;">H</td><td style="text-align: center;;">2</td><td style="text-align: center;;">2</td></tr><tr ><td style="color: #161120;text-align: center;">6</td><td style="text-align: center;;">BOS</td><td style="text-align: center;;">WS1</td><td style="text-align: center;;">H</td><td style="text-align: center;;">1</td><td style="text-align: center;;">3</td></tr><tr ><td style="color: #161120;text-align: center;">7</td><td style="text-align: center;;">BOS</td><td style="text-align: center;;">WS1</td><td style="text-align: center;;">H</td><td style="text-align: center;;">2</td><td style="text-align: center;;">4</td></tr><tr ><td style="color: #161120;text-align: center;">8</td><td style="text-align: center;;">BOS</td><td style="text-align: center;;">NYA</td><td style="text-align: center;;">H</td><td style="text-align: center;;">1</td><td style="text-align: center;;">5</td></tr><tr ><td style="color: #161120;text-align: center;">9</td><td style="text-align: center;;">BOS</td><td style="text-align: center;;">PHA</td><td style="text-align: center;;">A</td><td style="text-align: center;;">1</td><td style="text-align: center;;">1</td></tr><tr ><td style="color: #161120;text-align: center;">10</td><td style="text-align: center;;">BOS</td><td style="text-align: center;;">PHA</td><td style="text-align: center;;">A</td><td style="text-align: center;;">2</td><td style="text-align: center;;">2</td></tr><tr ><td style="color: #161120;text-align: center;">11</td><td style="text-align: center;;">BOS</td><td style="text-align: center;;">PHA</td><td style="text-align: center;;">A</td><td style="text-align: center;;">3</td><td style="text-align: center;;">3</td></tr><tr ><td style="color: #161120;text-align: center;">12</td><td style="text-align: center;;">BOS</td><td style="text-align: center;;">CHA</td><td style="text-align: center;;">H</td><td style="text-align: center;;">1</td><td style="text-align: center;;">1</td></tr><tr ><td style="color: #161120;text-align: center;">13</td><td style="text-align: center;;">BOS</td><td style="text-align: center;;">CHA</td><td style="text-align: center;;">H</td><td style="text-align: center;;">2</td><td style="text-align: center;;">2</td></tr><tr ><td style="color: #161120;text-align: center;">14</td><td style="text-align: center;;">BOS</td><td style="text-align: center;;">SLA</td><td style="text-align: center;;">H</td><td style="text-align: center;;">1</td><td style="text-align: center;;">3</td></tr><tr ><td style="color: #161120;text-align: center;">15</td><td style="text-align: center;;">BOS</td><td style="text-align: center;;">SLA</td><td style="text-align: center;;">H</td><td style="text-align: center;;">2</td><td style="text-align: center;;">4</td></tr><tr ><td style="color: #161120;text-align: center;">16</td><td style="text-align: center;;">BOS</td><td style="text-align: center;;">CLE</td><td style="text-align: center;;">H</td><td style="text-align: center;;">1</td><td style="text-align: center;;">5</td></tr><tr ><td style="color: #161120;text-align: center;">17</td><td style="text-align: center;;">BOS</td><td style="text-align: center;;">CLE</td><td style="text-align: center;;">H</td><td style="text-align: center;;">2</td><td style="text-align: center;;">6</td></tr><tr ><td style="color: #161120;text-align: center;">18</td><td style="text-align: center;;">BOS</td><td style="text-align: center;;">CLE</td><td style="text-align: center;;">H</td><td style="text-align: center;;">3</td><td style="text-align: center;;">7</td></tr><tr ><td style="color: #161120;text-align: center;">19</td><td style="text-align: center;;">BOS</td><td style="text-align: center;;">DET</td><td style="text-align: center;;">H</td><td style="text-align: center;;">1</td><td style="text-align: center;;">8</td></tr><tr ><td style="color: #161120;text-align: center;">20</td><td style="text-align: center;;">BOS</td><td style="text-align: center;;">DET</td><td style="text-align: center;;">H</td><td style="text-align: center;;">2</td><td style="text-align: center;;">9</td></tr><tr ><td style="color: #161120;text-align: center;">21</td><td style="text-align: center;;">BOS</td><td style="text-align: center;;">NYA</td><td style="text-align: center;;">A</td><td style="text-align: center;;">1</td><td style="text-align: center;;">1</td></tr><tr ><td style="color: #161120;text-align: center;">22</td><td style="text-align: center;;">BOS</td><td style="text-align: center;;">NYA</td><td style="text-align: center;;">A</td><td style="text-align: center;;">2</td><td style="text-align: center;;">2</td></tr><tr ><td style="color: #161120;text-align: center;">23</td><td style="text-align: center;;">BOS</td><td style="text-align: center;;">NYA</td><td style="text-align: center;;">A</td><td style="text-align: center;;">3</td><td style="text-align: center;;">3</td></tr><tr ><td style="color: #161120;text-align: center;">24</td><td style="text-align: center;;">BOS</td><td style="text-align: center;;">CHA</td><td style="text-align: center;;">A</td><td style="text-align: center;;">1</td><td style="text-align: center;;">4</td></tr><tr ><td style="color: #161120;text-align: center;">25</td><td style="text-align: center;;">BOS</td><td style="text-align: center;;">SLA</td><td style="text-align: center;;">A</td><td style="text-align: center;;">1</td><td style="text-align: center;;">5</td></tr><tr ><td style="color: #161120;text-align: center;">26</td><td style="text-align: center;;">BOS</td><td style="text-align: center;;">DET</td><td style="text-align: center;;">A</td><td style="text-align: center;;">1</td><td style="text-align: center;;">6</td></tr><tr ><td style="color: #161120;text-align: center;">27</td><td style="text-align: center;;">BOS</td><td style="text-align: center;;">DET</td><td style="text-align: center;;">A</td><td style="text-align: center;;">2</td><td style="text-align: center;;">7</td></tr><tr ><td style="color: #161120;text-align: center;">28</td><td style="text-align: center;;">BOS</td><td style="text-align: center;;">CLE</td><td style="text-align: center;;">A</td><td style="text-align: center;;">1</td><td style="text-align: center;;">8</td></tr><tr ><td style="color: #161120;text-align: center;">29</td><td style="text-align: center;;">BOS</td><td style="text-align: center;;">NYA</td><td style="text-align: center;;">H</td><td style="text-align: center;;">1</td><td style="text-align: center;;">1</td></tr><tr ><td style="color: #161120;text-align: center;">30</td><td style="text-align: center;;">BOS</td><td style="text-align: center;;">PHA</td><td style="text-align: center;;">A</td><td style="text-align: center;;">1</td><td style="text-align: center;;">1</td></tr><tr ><td style="color: #161120;text-align: center;">31</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;">32</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>Worksheet 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">H2</th><td style="text-align:left">=IF(<font color="Blue">(<font color="Red">C1=C2</font>)*(<font color="Red">D1=D2</font>),H1+1,1</font>)</td></tr><tr><th width="10px" style=" background-color: #E0E0F0;color: #161120">I2</th><td style="text-align:left">=IF(<font color="Blue">(<font color="Red">C1=C2</font>)*(<font color="Red">E1=E2</font>),I1+1,1</font>)</td></tr></tbody></table></td></tr></table><br />
Markmzz
 
Upvote 0

Forum statistics

Threads
1,224,524
Messages
6,179,304
Members
452,904
Latest member
CodeMasterX

We've detected that you are using an adblocker.

We have a great community of people providing Excel help here, but the hosting costs are enormous. You can help keep this site running by allowing ads on MrExcel.com.
Allow Ads at MrExcel

Which adblocker are you using?

Disable AdBlock

Follow these easy steps to disable AdBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the icon in the browser’s toolbar.
2)Click on the "Pause on this site" option.
Go back

Disable AdBlock Plus

Follow these easy steps to disable AdBlock Plus

1)Click on the icon in the browser’s toolbar.
2)Click on the toggle to disable it for "mrexcel.com".
Go back

Disable uBlock Origin

Follow these easy steps to disable uBlock Origin

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back

Disable uBlock

Follow these easy steps to disable uBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back
Back
Top