Modify Aggregate Function

Tikey

Board Regular
Joined
Jan 30, 2014
Messages
148
Office Version
  1. 2021
Platform
  1. Windows
Hi

I am using the following formula to find the earliest date in a column of cells for a particular year, in this example, 1994.

=AGGREGATE(15,6,Records!$F:$F/(YEAR(Records!$F:$F)=1994),1)

I now wish to modify this such that it will only consider cells where a corresponding cell has a value of >0.

A B
1/1/1994 0
2/1/1994 2
3/1/1994 1
6/1/1993 5

So in the above example, if I were to be looking for the earliest date in 1994, the answer would be 2/1/1994 as cell B1 only has a value of 0

Can anyone offer a solution

Thanks
 

Excel Facts

What does custom number format of ;;; mean?
Three semi-colons will hide the value in the cell. Although most people use white font instead.
Try something like this

=AGGREGATE(15,6,Records!$F$2:$F$100/((YEAR(Records!$F$2:$F$100)=1994)*(Records!$G$2:$G$100>0)),1)

Adjust the $100 as needed but I strongly recommend not using full column references with formulas like this. With full column references this formula takes about 500 times as long to calculate as this one with restricted rows.
 
Last edited:
Upvote 0
Control+shift+enter, not just enter:

=MIN(IF(ISNUMBER(1/($F$2:$F$100*$G$2:$G$100)),IF(YEAR($F$2:$F$100)=1994,IF($G$2:$G$100>0,$F$2:$F$100))))

Just enter:

=MINIFS(F2:F100,F2:F100,">="&DATE(1994,1,1),F2:F100,"<="&DATE(1994,12,31),G2:G100,">0")

Just enter:

=AGGREGATE(15,6,Records!$F:$F/((YEAR(Records!$F:$F)=1994)*(Records!$G:$G>0)),1)

Note that the latter does not test whether F and G are numbers.
 
Upvote 0
Thanks very much to both of you, your solutions worked great.
 
Upvote 0

Forum statistics

Threads
1,223,893
Messages
6,175,248
Members
452,623
Latest member
cliftonhandyman

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