Complex - Multiple Criteria

dunmore83

Well-known Member
Joined
Aug 24, 2011
Messages
540

Excel 2012
BCDEFGHIJKLMNOPQ
2Ear TagSexNLISBirth Date01-Jul-1402-Jul-1403-Jul-1404-Jul-1405-Jul-1406-Jul-1407-Jul-1408-Jul-14
3
4
51658Heifer-04.09.1104-Sep-111,0311,0321,0331,0341,0351,0361,0371,038
62112Heifer98212349040565410.08.1210-Aug-12690691692693694695696697
7272Heifer98212349042566827.08.1227-Aug-12673674675676677678679680
82282Heifer98212349042575728.09.1228-Sep-12641642643644645646647648
93007Heifer98212349042517624.01.1324-Jan-13523524525526527528529530
103008Heifer98212349041793224.01.1324-Jan-13523524525526527528529530
113018Heifer98212349042585829.01.1329-Jan-13518519520521522523524525
123026Heifer98212349884756131.01.1331-Jan-13516517518519520521522523
133040Heifer98212349044906306.02.1306-Feb-13510511512513514515516517
143042Heifer98212349041773706.02.1306-Feb-13510511512513514515516517
153053Heifer98212349040556007.02.1307-Feb-13509510511512513514515516
163052Heifer98212349044912507.02.1307-Feb-13509510511512513514515516
173051Heifer98212348946245407.02.1307-Feb-13509510511512513514515516
183055Heifer98212349042596708.02.1308-Feb-13508509510511512513514515
193054Heifer98212349042584808.02.1308-Feb-13508509510511512513514515
203064Heifer98212349041751511.02.1311-Feb-13505506507508509510511512
213061Heifer98212349041970811.02.1311-Feb-13505506507508509510511512
223065Heifer98212349884768512.02.1312-Feb-13504505506507508509510511
233069Heifer98209101630871614.02.1314-Feb-13502503504505506507508509
243071Heifer98212349044781914.02.1314-Feb-13502503504505506507508509
253074Heifer98212349042503917.02.1317-Feb-13499500501502503504505506
263084Heifer98212349022669126.02.1326-Feb-13490491492493494495496497
273088Heifer98212349042514028.02.1328-Feb-13488489490491492493494495
283090Heifer98212348946404203.03.1303-Mar-13485486487488489490491492
293098Heifer98212348945935611.03.1311-Mar-13477478479480481482483484
303104Heifer98212348946636001.04.1301-Apr-13456457458459460461462463
313161Heifer98212349022404109.08.1309-Aug-13326327328329330331332333
323176Heifer98200019176311915.08.1315-Aug-13320321322323324325326327
333179Heifer98200019180582116.08.1316-Aug-13319320321322323324325326
343190Heifer98200019172751218.08.1318-Aug-13317318319320321322323324
353186Heifer98212349885183918.08.1318-Aug-13317318319320321322323324
363191Heifer98200019173670919.08.1319-Aug-13316317318319320321322323
ages-excel-forum
 
There will be numerous columns with min & max dates... for example another column might be 04-Sep-14 to 29-Jan-15 then in this situation the formula needs to behave exactly like you had previously.

It's just when a part of the min/max range falls before 01-July-14 that the modification needs to be made.

Make any sense ? If not I will post an example
 
Upvote 0

Excel Facts

Return population for a City
If you have a list of cities in A2:A100, use Data, Geography. Then =A2.Population and copy down.

Excel 2012
DEFGHIJKLMNOPQRS
3
4
5
6Start #Start #Start #
7
8
924-Jan-1311-Jan-1404-Sep-1425-Mar-15
10
11
1201-Oct-1322-Apr-1429-Jan-1530-Jun-15
13
14
152238100
16Jul-14312238100
17Aug-14312238100
18Sep-143022381160
19Oct-143122381250
20Nov-143022381650
21Dec-1431223811040
22Jan-1531223811230
23Feb-1528223811230
24Mar-15312238112310
25Apr-15302238112348
26May-15312238112385
27Jun-153022381123107
Stock-Summary-forum
 
Upvote 0
The formula in row 15 is =COUNTIFS(Sheet1!$F$4:$F$667,">="&J$9,Sheet1!$F$4:$F$667,"<="&$D16)

Problem is this is assuming everything prior to 01-Jul-14 will go into the 1 group of numbers i.e. column J

However there will be numerous groups prior to 01-Jul-14 that need to be treated separately based on their min & max dates
 
Upvote 0
And if you change the date reference to J$12 do you get the right result?

=COUNTIFS(Sheet1!$F$4:$F$667,">="&J$9,Sheet1!$F$4:$F$667,"<="&$J$12)
 
Upvote 0
Yes until the July-14 year begins.. problem is there the formula sums everything between those dates. However it needs to follow the pattern of accumulating numbers when the July-14 year begins for those min & max values that fall within the Jul-14 to Jun-15 year
 
Upvote 0
I think i get it!!

This will test the date if less than 1/7/14 it uses the Max date if greater than the 1/7/14 it uses 1/7/14

=IF(K12<$E$15,COUNTIFS(Sheet1!$F$4:$F$659,">="&K$9,Sheet1!$F$4:$F$659,"<="&K$12),COUNTIFS(Sheet1!$F$4:$F$659,">="&K$9,Sheet1!$F$4:$F$659,"<="&$E$15))
 
Upvote 0
Sorry this is so confusing!!!

Does this formula to go in rows Jul-14 to Jun-15 or do we still need a separate formula in the row above Jun-14 ?
 
Upvote 0
K14

=IF(K12<$E$15,COUNTIFS(Sheet1!$F$4:$F$659,">="&K$9,Sheet1!$F$4:$F$659,"<="&K$12),COUNTIFS(Sheet1!$F$4:$F$659,">="&K$9,Sheet1!$F$4:$F$659,"<="&$E$15))

K15 copied down


=K14+SUMPRODUCT((TEXT(Sheet1!$F$4:$F$659,"mmyy")=TEXT($E15,"mmyy"))*(Sheet1!$F$4:$F$659>=K$9)*(Sheet1!$F$4:$F$659<=K$12))
 
Upvote 0
Thanks. Finally got there!!

Now I need to follow that on to work out the average age if you are interested?!
 
Upvote 0

Excel 2012
BCDEFGHIJKLMNO
1
2Ear TagSexNLISBirth Date10-Sep-1411-Sep-1412-Sep-1413-Sep-1414-Sep-1415-Sep-14
3
4
54108Heifer98209101485394118.04.1418-Apr-14145146147148149150
64109Heifer98209101484087719.04.1419-Apr-14144145146147148149
74110Heifer98212500093458519.04.1419-Apr-14144145146147148149
84113Heifer98209101484071020.04.1420-Apr-14143144145146147148
94114Heifer98209101482037822.04.1422-Apr-14141142143144145146
104115Heifer98209101630652704.09.1404-Sep-1467891011
114116Heifer98209101630896810.09.1410-Sep-14012345
124117Heifer98209101630500611.09.1411-Sep-14001234
134118Heifer98209101630428613.09.1413-Sep-14000012
Sheet1-forum
 
Upvote 0

Forum statistics

Threads
1,223,929
Messages
6,175,446
Members
452,642
Latest member
acarrigan

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