Help Creating a Dynamic Countifs Formula

randiliana

New Member
Joined
Dec 20, 2016
Messages
5
What I am trying to do, is to count all the cows, bred to a certain bull that are still in the herd, and that are going to calve on the first cycle (easy stuff). Problem is that the 1st cycle dates vary a bit from bull to bull.

So I want it to pull the date off of a 2nd sheet (Bulls) and compare it to the due dates on the first sheet (Breeding) and then return the answer on another sheet(Breeding Anal)... what I've got is


=COUNTIFS(Breeding!$D:$D,B$1,Breeding!$K:$K,"<>Y",Breeding!$R:$R,">0",Breeding!$R:$R,"<="&Bulls!G2)


But I want to make it dynamic, so I don't literally have to go and change "<="&Bulls!G2 for each bull (there's 14 columns)
I've tried

=COUNTIFS(Breeding!$D:$D,B$1,Breeding!$K:$K,"<>Y",Breeding!$R:$R,"<="Index(Bulls!$G:$G,Match(B$1,Bulls!$A:$A)

but that doesn't work... any ideas?

The Breeding Sheet
15621845_10210060525443274_510438372971684570_n.jpg


The Bulls Sheet
15590536_10210060525643279_2472753378469646920_n.jpg


The Analysis Sheet
15621589_10210060525603278_8988412992975467347_n.jpg
 

Excel Facts

Pivot Table Drill Down
Double-click any number in a pivot table to create a new report showing all detail rows that make up that number
try this instead

"<="&VLOOKUP(Bulls!G$2,Bulls!$A:$G,7,0)
 
Upvote 0
actually your original formula should work with minor amendment

"<="&INDEX(Bulls!$G:$G,MATCH(B$1,Bulls!$A:$A,0))
 
Upvote 0
and the

What I am trying to do, is to count all the cows, bred to a certain bull that are still in the herd, and that are going to calve on the first cycle (easy stuff). Problem is that the 1st cycle dates vary a bit from bull to bull.

So I want it to pull the date off of a 2nd sheet (Bulls) and compare it to the due dates on the first sheet (Breeding) and then return the answer on another sheet(Breeding Anal)... what I've got is

 
Upvote 0
OK, now what am I doing wrong? Seems like it should be straight forward.... I want it to count the # between 2 dates

=COUNTIFS(Breeding!$D:$D,C$1,Breeding!$K:$K,"<>Y",Breeding!$R:$R,"<="&INDEX(Bulls!$H:$H,MATCH(C$1,Bulls!$A:$A,0),Breeding!$R:$R,">"&INDEX(Bulls!$G:$G,MATCH(C$1,Bulls!$A:$A,0))))
 
Upvote 0
nothing stick out. what do you get from

=INDEX(Bulls!$H:$H,MATCH(C$1,Bulls!$A:$A,0) ?
 
Upvote 0

Forum statistics

Threads
1,214,416
Messages
6,119,384
Members
448,889
Latest member
TS_711

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