Array Formula Problem

akovner

New Member
Joined
Aug 31, 2011
Messages
3
I posted this earlier, but I explained it poorly, so here goes again.

I have a table (called 'Table1') which 2 columns. In column one is each month of 2010 (the first day of each month as a date), in column 2 is a 1 if the month has 31 days, 0 otherwise. In another table ('Table2') I have 10 months (the first day of each month as a date) and in the second column I have a revenue amount associated with that month. I wrote the following array formula:

=SUM(INDEX(Table1, MATCH(Table2[Column1], Table1[Column1], 0), 2) * Table2[Column2])

This should give me the sum of revenue for ONLY those months with 31 days, but instead I get the sum of revenue for ALL the months.

Strangely, when I enter just the piece inside the sum as an array formula (across 10 cells) I get the correct array. That is,

=INDEX(Table1, MATCH(Table2[Column1], Table1[Column1], 0), 2) * Table2[Column2]

Gives me an array with zeros for months with <31 days, and the proper revenue for months with 31 days.

Why isn't the 1-cell array formula working?

Thanks.
 

Excel Facts

Square and cube roots
The =SQRT(25) is a square root. For a cube root, use =125^(1/3). For a fourth root, use =625^(1/4).
This is a SUMPRODUCT formula that only sums the Months with 31 days
<br /><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 /></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></tr></thead><tbody><tr ><td style="color: #161120;text-align: center;">1</td><td style="text-align: right;;">1/1/2011</td><td style="text-align: right;background-color: #FFFF99;;">1</td><td style="text-align: right;;"></td><td style=";">SUM of Months with 31 days</td></tr><tr ><td style="color: #161120;text-align: center;">2</td><td style="text-align: right;;">2/1/2011</td><td style="text-align: right;;">2</td><td style="text-align: right;;"></td><td style="text-align: center;;">152</td></tr><tr ><td style="color: #161120;text-align: center;">3</td><td style="text-align: right;;">3/1/2011</td><td style="text-align: right;background-color: #FFFF99;;">3</td><td style="text-align: right;;"></td><td style="text-align: right;;"></td></tr><tr ><td style="color: #161120;text-align: center;">4</td><td style="text-align: right;;">4/1/2011</td><td style="text-align: right;;">4</td><td style="text-align: right;;"></td><td style="text-align: right;;"></td></tr><tr ><td style="color: #161120;text-align: center;">5</td><td style="text-align: right;;">5/1/2011</td><td style="text-align: right;background-color: #FFFF99;;">5</td><td style="text-align: right;;"></td><td style="text-align: right;;"></td></tr><tr ><td style="color: #161120;text-align: center;">6</td><td style="text-align: right;;">6/1/2011</td><td style="text-align: right;;">6</td><td style="text-align: right;;"></td><td style="text-align: right;;"></td></tr><tr ><td style="color: #161120;text-align: center;">7</td><td style="text-align: right;;">7/1/2011</td><td style="text-align: right;background-color: #FFFF99;;">7</td><td style="text-align: right;;"></td><td style="text-align: right;;"></td></tr><tr ><td style="color: #161120;text-align: center;">8</td><td style="text-align: right;;">8/1/2011</td><td style="text-align: right;background-color: #FFFF99;;">8</td><td style="text-align: right;;"></td><td style="text-align: right;;"></td></tr><tr ><td style="color: #161120;text-align: center;">9</td><td style="text-align: right;;">9/1/2011</td><td style="text-align: right;;">9</td><td style="text-align: right;;"></td><td style="text-align: right;;"></td></tr><tr ><td style="color: #161120;text-align: center;">10</td><td style="text-align: right;;">10/1/2011</td><td style="text-align: right;background-color: #FFFF99;;">10</td><td style="text-align: right;;"></td><td style="text-align: right;;"></td></tr><tr ><td style="color: #161120;text-align: center;">11</td><td style="text-align: right;;">11/1/2011</td><td style="text-align: right;;">11</td><td style="text-align: right;;"></td><td style="text-align: right;;"></td></tr><tr ><td style="color: #161120;text-align: center;">12</td><td style="text-align: right;;">12/1/2011</td><td style="text-align: right;background-color: #FFFF99;;">12</td><td style="text-align: right;;"></td><td style="text-align: right;;"></td></tr><tr ><td style="color: #161120;text-align: center;">13</td><td style="text-align: right;;">1/1/2012</td><td style="text-align: right;background-color: #FFFF99;;">13</td><td style="text-align: right;;"></td><td style="text-align: right;;"></td></tr><tr ><td style="color: #161120;text-align: center;">14</td><td style="text-align: right;;">2/1/2012</td><td style="text-align: right;;">14</td><td style="text-align: right;;"></td><td style="text-align: right;;"></td></tr><tr ><td style="color: #161120;text-align: center;">15</td><td style="text-align: right;;">3/1/2012</td><td style="text-align: right;background-color: #FFFF99;;">15</td><td style="text-align: right;;"></td><td style="text-align: right;;"></td></tr><tr ><td style="color: #161120;text-align: center;">16</td><td style="text-align: right;;">4/1/2012</td><td style="text-align: right;;">16</td><td style="text-align: right;;"></td><td style="text-align: right;;"></td></tr><tr ><td style="color: #161120;text-align: center;">17</td><td style="text-align: right;;">5/1/2012</td><td style="text-align: right;background-color: #FFFF99;;">17</td><td style="text-align: right;;"></td><td style="text-align: right;;"></td></tr><tr ><td style="color: #161120;text-align: center;">18</td><td style="text-align: right;;">6/1/2012</td><td style="text-align: right;;">18</td><td style="text-align: right;;"></td><td style="text-align: right;;"></td></tr><tr ><td style="color: #161120;text-align: center;">19</td><td style="text-align: right;;">7/1/2012</td><td style="text-align: right;background-color: #FFFF99;;">19</td><td style="text-align: right;;"></td><td style="text-align: right;;"></td></tr><tr ><td style="color: #161120;text-align: center;">20</td><td style="text-align: right;;">8/1/2012</td><td style="text-align: right;background-color: #FFFF99;;">20</td><td style="text-align: right;;"></td><td style="text-align: right;;"></td></tr><tr ><td style="color: #161120;text-align: center;">21</td><td style="text-align: right;;">9/1/2012</td><td style="text-align: right;;">21</td><td style="text-align: right;;"></td><td style="text-align: right;;"></td></tr><tr ><td style="color: #161120;text-align: center;">22</td><td style="text-align: right;;">10/1/2012</td><td style="text-align: right;background-color: #FFFF99;;">22</td><td style="text-align: right;;"></td><td style="text-align: right;;"></td></tr><tr ><td style="color: #161120;text-align: center;">23</td><td style="text-align: right;;">11/1/2012</td><td style="text-align: right;;">23</td><td style="text-align: right;;"></td><td style="text-align: right;;"></td></tr></tbody></table><br /><br /><table 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">D2</th><td style="text-align:left">=SUMPRODUCT(<font color="Blue">--(<font color="Red">DAY(<font color="Green">A1:A23+30</font>)=31</font>),B1:B23</font>)</td></tr></tbody></table></td></tr></table><br />
 
Upvote 0
Thank you for the swift response. To be honest, the case I presented is really a test case. What I really want to be able to do is use INDEX and MATCH in array formulas in general (I have a few problems which require this). I am really curious if there is a way to correct my formula while still using INDEX and MATCH, or some equivalent lookup functions.

Thanks again.
 
Upvote 0

Forum statistics

Threads
1,224,603
Messages
6,179,849
Members
452,948
Latest member
UsmanAli786

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