Please help me to get with formula to get minimum & maximum with different criteria from below table:

afmrubayat

New Member
Joined
Nov 29, 2009
Messages
27
Minimum & Maximum of feeding cost required in H2 column matching type of animal input given in E2 with specified Beginning Date in F2 and End Date in G2
ABCDEFGHI
1DateType of AnimalFeeding costType of AnimalBeginning DateEnd DateMin CostMax Cost
21-Oct-16Cow23Cat2-Oct-164-Oct-162425
32-Oct-16Cow24
43-Oct-16Cow25
54-Oct-16Cow30
65-Oct-16Cow20
71-Oct-16Dog23
82-Oct-16Dog24
93-Oct-16Dog25
104-Oct-16Dog30
115-Oct-16Dog20
121-Oct-16Cat23
132-Oct-16Cat24
143-Oct-16Cat25
154-Oct-16Cat30
165-Oct-16Cat20
171-Oct-16Bird23
182-Oct-16Bird24
193-Oct-16Bird25
204-Oct-16Bird30
205-Oct-16Bird20

<colgroup><col span="16"></colgroup><tbody>
</tbody>
 

Excel Facts

Can Excel fill bagel flavors?
You can teach Excel a new custom list. Type the list in cells, File, Options, Advanced, Edit Custom Lists, Import, OK
Hi,

If I understood you correctly, you need formula in column G & H for min and max costs as per animal chosen between the date ranges specified.

This is what I came up with;

Paste this in column M for Minimum calculation .. MIN(IF(I3<=$A$3:$A$22,IF(K3>=$A$3:$A$22,IF(G3=$C$3:$C$22,$E$3:$E$22))))

Maximum calculation =MAX(IF(I3<=$A$3:$A$22,IF(K3>=$A$3:$A$22,IF(G3=$C$3:$C$22,$E$3:$E$22))))

Hope this helps.
 
Upvote 0
In H2 control+shift+enter, not just enter:

=MIN(IF($B$2:$B$21=E2,IF($A$2:$A$21>=F2,IF($A$2:$A$21<=G2,$C$2:$C$21))))

In I2 repeat this formula but replace MIN with MAX.
 
Upvote 0
Dates also

E2: {=MIN(IF($D$2=$B$2:$B$21,$A$2:$A$21))}
F2: {=MAX(IF($D$2=$B$2:$B$21,$A$2:$A$21))}
G2: {=MIN(IF($D$2=$B$2:$B$21,$C$2:$C$21))}
H2: {=MAX(IF($D$2=$B$2:$B$21,$C$2:$C$21))}
 
Upvote 0
Thanks a lot. But is any formula without using ctrl+shift+enter. If the information contain some blank row it giving zero how to ignore them. Actual data is around more than 30,000 row data how to use this formula for that?
 
Upvote 0
Thanks a lot. But is any formula without using ctrl+shift+enter. If the information contain some blank row it giving zero how to ignore them. Actual data is around more than 30,000 row data how to use this formula for that?

Control+shift+enter, not just enter:

=MIN(IF($B$2:$B$21=E2,IF($A$2:$A$21>=F2,IF($A$2:$A$21<=G2,IF(ISNUMBER($C$2:$C$21),$C$2:$C$21)))))

No edit is required for the max value... again control+shift+enter:

=MAX(IF($B$2:$B$21=E2,IF($A$2:$A$21>=F2,IF($A$2:$A$21<=G2,$C$2:$C$21))))
 
Upvote 0
=MIN(IF($C$2:$C$397095=K10,IF($B$2:$B$397095>=L10,IF($B$2:$B$397095<=M10,IF(ISNUMBER($D$2:$D$397095),$D$2:$D$397095)))))
formula not working please check. I have 397095 row in actual data
 
Upvote 0
=MIN(IF($C$2:$C$397095=K10,IF($B$2:$B$397095>=L10,IF($B$2:$B$397095<=M10,IF(ISNUMBER($D$2:$D$397095),$D$2:$D$397095)))))
formula not working please check. I have 397095 row in actual data

Control+shift+enter means: Press down the control and the shift keys at the same time while you hit the enter key. If done properly, Excel itself will put a pair of { and } around the formula in recognition.

By the way, the ranges are huge, so performance won't be great.
 
Upvote 0

Forum statistics

Threads
1,214,819
Messages
6,121,739
Members
449,050
Latest member
excelknuckles

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