Need MIN/MAX from Range That Varies Daily

madkinson

Board Regular
Joined
Dec 17, 2004
Messages
113
Office Version
  1. 365
Platform
  1. Windows
I generate a sheet every day that has 4 activities and associated data. I need to capture the MIN and MAX as part of the requirement. that is easy manually but how can you automate this every day to account for a different Activity range? In my example sheet, Activity 12 is rows 22 thru 25. Tomorrow, it may be rows 25 thru 40. I tried to do an INDEX/MATCH but it too wasn't flexible enough to deal with different ranges. Am I making this too hard?
Book3
ABCDEF
1Doc #DateAct # Qty MINMAX
210920438905/23/2022114.37
310920436335/23/2022125.67(3,000)
410920436415/23/2022126.56820
510920436435/23/2022124.60(1,500)
610920436465/23/2022123.70(5,400)
710920436625/23/2022221.16(2,400)
810920436765/23/2022222.54
910920437535/23/2022225.14(520)
1010920437625/23/2022222.30(1,160)
1110920437655/23/2022218.75
1210920437675/23/2022216.922,520
1310920438285/23/20221124.29(500)
1410920438435/23/20221125.86
1510920438475/23/20221124.20
1610920438545/23/20221123.85
1710920438645/23/20221122.88(500)
1810920438815/23/20221124.44
1910920438865/23/20221123.60
2010920438875/23/20221124.65
2110920438985/23/20221123.50(500)
2210920436095/23/20221222.491,250
2310920436125/23/20221227.71
2410920436175/23/20221225.25460
2510920436215/23/20221224.33
Sheet1
 

Excel Facts

Convert text numbers to real numbers
Select a column containing text numbers. Press Alt+D E F to quickly convert text to numbers. Faster than "Convert to Number"
Try these formulas in row 2 (other results will automatically 'spill' to the required rows).

madkinson.xlsm
ABCDEFGHIJ
1Doc #DateAct # Qty MINMAXActivityMINMAX
2109204389023/05/2022114.371(5,400.00)820.00
3109204363323/05/2022125.67(3000.00)2(2,400.00)2,520.00
4109204364123/05/2022126.5682011(500.00)
5109204364323/05/2022124.6(1500.00)121,250.00
6109204364623/05/2022123.7(5400.00)
7109204366223/05/2022221.16(2400.00)
8109204367623/05/2022222.54
9109204375323/05/2022225.14(520.00)
10109204376223/05/2022222.3(1160.00)
11109204376523/05/2022218.75
12109204376723/05/2022216.922520
13109204382823/05/20221124.29(500.00)
14109204384323/05/20221125.86
15109204384723/05/20221124.2
16109204385423/05/20221123.85
17109204386423/05/20221122.88(500.00)
18109204388123/05/20221124.44
19109204388623/05/20221123.6
20109204388723/05/20221124.65
21109204389823/05/20221123.5(500.00)
22109204360923/05/20221222.491250
23109204361223/05/20221227.71
24109204361723/05/20221225.25460
25109204362123/05/20221224.33
Sheet1
Cell Formulas
RangeFormula
H2:H5H2=UNIQUE(C2:C25)
I2:I5I2=IF(COUNTIFS(E2:E25,"<0",C2:C25,H2#),MINIFS(E2:E25,C2:C25,H2#),"")
J2:J5J2=IF(COUNTIFS(F2:F25,">0",C2:C25,H2#),MAXIFS(F2:F25,C2:C25,H2#),"")
Dynamic array formulas.
 
Upvote 0
Solution
Try
Using your data sample above

Pasta1
HIJ
1ActivityMINMAX
21(5.400)820
32(2.400)2520
411(500) 
512 1250
Plan6
Cell Formulas
RangeFormula
I2:I5I2=IFERROR(AGGREGATE(15,6,E$2:E$300/((C$2:C$300=H2)*ISNUMBER(E$2:E$300)),1),"")
J2:J5J2=IFERROR(AGGREGATE(14,6,F$2:F$300/((C$2:C$300=H2)*ISNUMBER(F$2:F$300)),1),"")


M.
Sorry to be so tardy in responding (other work demands). Marcelo, I do not follow what you are doing here. IN teh second line, the AGGREGATE is looing for the MAX (LARGE (14)). The second value (6) is saying ignore errors. Then you define the range (F$2:F$300). After that I get lost. You are dividing the first expression by a value (where the value in the C$ range equals the Activity and taking the largest value?) but what does the rest of the string mean?
 
Upvote 0
Marcelo, I do not follow what you are doing here.

To consider only the values according to the criteria, the formula divides the values in F2:F300 by the conditions, that is:
Values in C2:C300 must be equal to the value in H2 (criterion1)
AND
Must be numbers (criterion2). I added this second criterion so that the formula does not return 0 in cases where there are only blank cells in column F in the rows that meet criterion 1 - in these cases the AGGREGATE function will result in Error and the formula will return an empty string as desired.

M.
 
Upvote 0
By the way...
Peter has provided a better solution using the new functions available in Excel 365. Stick with them

M.
 
Upvote 0
Try these formulas in row 2 (other results will automatically 'spill' to the required rows).

madkinson.xlsm
ABCDEFGHIJ
1Doc #DateAct # Qty MINMAXActivityMINMAX
2109204389023/05/2022114.371(5,400.00)820.00
3109204363323/05/2022125.67(3000.00)2(2,400.00)2,520.00
4109204364123/05/2022126.5682011(500.00)
5109204364323/05/2022124.6(1500.00)121,250.00
6109204364623/05/2022123.7(5400.00)
7109204366223/05/2022221.16(2400.00)
8109204367623/05/2022222.54
9109204375323/05/2022225.14(520.00)
10109204376223/05/2022222.3(1160.00)
11109204376523/05/2022218.75
12109204376723/05/2022216.922520
13109204382823/05/20221124.29(500.00)
14109204384323/05/20221125.86
15109204384723/05/20221124.2
16109204385423/05/20221123.85
17109204386423/05/20221122.88(500.00)
18109204388123/05/20221124.44
19109204388623/05/20221123.6
20109204388723/05/20221124.65
21109204389823/05/20221123.5(500.00)
22109204360923/05/20221222.491250
23109204361223/05/20221227.71
24109204361723/05/20221225.25460
25109204362123/05/20221224.33
Sheet1
Cell Formulas
RangeFormula
H2:H5H2=UNIQUE(C2:C25)
I2:I5I2=IF(COUNTIFS(E2:E25,"<0",C2:C25,H2#),MINIFS(E2:E25,C2:C25,H2#),"")
J2:J5J2=IF(COUNTIFS(F2:F25,">0",C2:C25,H2#),MAXIFS(F2:F25,C2:C25,H2#),"")
Dynamic array formulas.
Pete, your solution works just like I needed. Now I have to bone up on the new stuff in Excel 365. Thanks for your help.
 
Upvote 0

Forum statistics

Threads
1,224,828
Messages
6,181,206
Members
453,022
Latest member
RobertV1609

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