CountIf Array Formula Required for Two Range Data Set: Excel 2010

L

Legacy 338537

Guest
Hi guys,

Trying to develop an array formula that can handle two ranges and result in a simple count.

At present my data is split between two cells, one of which is a $ amount, the other is a date (as seen below).

Sale PriceSale Date
$384,0008/01/2013
$640,0008/01/2013
$310,00010/01/2013
$520,33012/01/2014
$204,63014/01/2014
$257,10016/01/2014
$770,35018/01/2014

<colgroup><col style="text-align: center;"><col style="text-align: center;"></colgroup><tbody>
</tbody>

I am trying to group each $ amount in individual ranges (Say $500,000 - $599,999) and only calculate that range for each individual year.

As there is typically up to thousands of cells of data, doing this manually is incredibly time consuming and I am hoping to create a Array formula to help me out.

I have been able to aggregate the total $ amounts between each ranges with the following formula:

=COUNTIF($A$3:$A$300000,">="&450000)-COUNTIF($A$3:$A$300000,">="&499999)

(Please note this is for sales between $450,000 and $499,999 simply as an example and I will adjust the formula once complete to encompass new ranges)

However this does not break the data down into individual years which is what i'm stuck with. Any help would be greatly appreciated!

Many thanks in advance
 

Excel Facts

Spell Check in Excel
Press F7 to start spell check in Excel. Be careful, by default, Excel does not check Capitalized Werds (whoops)
Thanks for your reply Aladin, apologies for the oversight! Please see the example below:

Year$250,000 - $299,999$300,000 - $349,999$350,000 - $399,999$400,000 - $449,999$450,000 - $499,999$500,000 - $549,999
2010





2011





2012





2013





2014





2015

<tbody>
</tbody>

As I said before, I'm happy to adjust the formula for each range as require, just looking to get a more solid starting point.
 
Upvote 0
Try this
Excel Workbook
AB
1Sale PriceSale Date
2$384,00008-01-2013
3$640,00008-01-2013
4$310,00010-01-2013
5$520,33012-01-2014
6$204,63014-01-2014
7$257,10016-01-2014
8$770,35018-01-2014
Sheet2
Excel 2010
Excel Workbook
FGHIJKL
2$250,000$300,000$350,000$400,000$450,000$500,000
3Year$299,999$349,999$399,999$449,999$499,999$549,999
42010000000
52011000000
62012000000
72013011000
82014100001
92015000000
Sheet2
Excel 2010
Cell Formulas
RangeFormula
G4=SUMPRODUCT(--(YEAR($B$2:$B$8)=$F4),--($A$2:$A$8>=G$2),--($A$2:$A$8<=G$3))
 
Upvote 0
Thanks for your reply Aladin, apologies for the oversight! Please see the example below:

Year$250,000 - $299,999$300,000 - $349,999$350,000 - $399,999$400,000 - $449,999$450,000 - $499,999$500,000 - $549,999
2010





2011





2012





2013





2014





2015

<tbody>
</tbody>

As I said before, I'm happy to adjust the formula for each range as require, just looking to get a more solid starting point.

What follows invokes a COUNTIFS formula which is a tad faster...

Row\Col
A​
B​
C​
D​
E​
F​
G​
H​
I​
J​
K​
1​
Sale PriceSale Date
$250,000
$300,000
$350,000
$400,000
$450,000
$500,000
2​
$384,000
1/8/2013
Year
$299,999
$349,999
$399,999
$449,999
$499,999
$549,999
3​
$640,000
1/8/2013
2010
0
0
0
0
0
0
4​
$310,000
1/10/2013
2011
0
0
0
0
0
0
5​
$520,330
1/12/2014
2012
0
0
0
0
0
0
6​
$204,630
1/14/2014
2013
0
1
1
0
0
0
7​
$257,100
1/16/2014
2014
1
0
0
0
0
1
8​
$770,350
1/18/2014
2015
0
0
0
0
0
0

<tbody>
</tbody>


F3, copy across and down:

=COUNTIFS($B:$B,">="&DATE($E3,1,1),$B:$B,"<="&DATE($E3,12,31),$A:$A,">="&F$1,$A:$A,"<="&F$2)
 
Upvote 0
Thank you both for your swift replies! Both options worked perfectly. If I wanted to do a Median of the ranges rather than a Sum would I need to change the formula dramatically?
 
Upvote 0
Thank you both for your swift replies! Both options worked perfectly. If I wanted to do a Median of the ranges rather than a Sum would I need to change the formula dramatically?

For conditional median...

F5, control+shift+enter, not just enter, copy across, and down:

=IFERROR(MEDIAN(IF(YEAR($B$2:$B$8)=$E3,IF($A$2:$A$8>=F$1,IF($A$2:$A$8<=F$2,$A$2:$A$8)))),"")
 
Upvote 0
For conditional median...

F5, control+shift+enter, not just enter, copy across, and down:

=IFERROR(MEDIAN(IF(YEAR($B$2:$B$8)=$E3,IF($A$2:$A$8>=F$1,IF($A$2:$A$8<=F$2,$A$2:$A$8)))),"")


Fantastic Aladin, worked perfectly! Much appreciated!
 
Upvote 0
You are welcome.

Sorry to annoy you Aladin but I just had one last question. I'm trying to do the same formula but for half yearly segmentation instead:

I have tried the following (which is my best attempt):

=MEDIAN(IF($B5:$B300000,">="&DATE($H41,1,1),$B5:$B300000),"<="&DATE($H41,6,30),IF($A$5:$A$300000>=AK$3,IF($A$5:$A$300000<=AK$4,$A$5:$A$300000)))

Where-
B5:B300000 is the range of Sale Dates.
A5:A300000 is the range of Sale Prices
H41 is the Year
and
AK3 and AK4 are the Two Price Ranges

However it returns a #VALUE! Error. Any suggestions?
 
Upvote 0

Forum statistics

Threads
1,215,488
Messages
6,125,092
Members
449,206
Latest member
ralemanygarcia

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