Problems with an array formula...

Z_Sutcliffe123

New Member
Joined
Apr 5, 2019
Messages
8
I have 2 sheets on my workbook. Sheet 1 has all the master data. I'm using Sheet 2 to pull data from Sheet 1.


Sheet 1 has the date in Column A, that date is converted to month text in Column B and in Column C I have the corresponding data for those dates - in this case a revenue number.


On Sheet 2 I have a dropdown list with the month names in (they definitely match the names in Column B on Sheet 1) in cell A2. I'm trying to pull in the corresponding revenue numbers from Column C on Sheet 1 when I select a certain month in the dropdown.


At the moment my array formula seems to be working but for one problem. I have copied it down 31 cells on Sheet 2 to account for the months with those most days. However, in months with fewer days like February it's displaying 3 days of data from March in the bottom 3 cells. Is there anyway to stop it including these March days? I've got no idea why it's happening but I suspect it's some error I've made with the COUNTIF part of the formula.


This is the formula I'm using:


=INDEX('Sheet1'!C1:C3000, MATCH(0, IF($A$2='Sheet1'!$B:$B,COUNTIF($B$2:$B$2,‘Sheet1’!$C:$C),""), 0))

Any help would be greatly appreciated.
 

Excel Facts

What do {} around a formula in the formula bar mean?
{Formula} means the formula was entered using Ctrl+Shift+Enter signifying an old-style array formula.
Im unclear what you are trying to do. What is in Sheet2? Do you want the sum of each day or each month?
 
Upvote 0
Sure. What do you mean by 'get'? Get the first value? Sum all of the values? Bring all of the rows over? Like i say its unclear.
 
Upvote 0
Before go any further what do these produce:

=ISNUMBER(Sheet1!B2)
=ISNUMBER(Sheet2!B2)

where both are pointing at the textual month in each sheet (eg Feb-19). Just need to check comparing like with like.
 
Upvote 0
Upvote 0
You can do it in one cell like this:

=IF(ROWS($A$1:A1)<=DAY(EOMONTH(0+(1&$B$2),0)),INDEX(Sheet1!$D$2:$D$1000,MATCH(0+(ROWS($A$1:A1)&$B$2),Sheet1!$A$2:$A$1000,0)),"")

however id put a column of dates in corresponding to the month then use them. Let me know if you want to use that route or what i have given is ok.
 
Upvote 0

Forum statistics

Threads
1,223,888
Messages
6,175,206
Members
452,618
Latest member
Tam84

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