Calculating max & min from a range of data indirectly identified

roscoe

Well-known Member
Joined
Jun 4, 2002
Messages
1,062
Office Version
  1. 365
Platform
  1. Windows
  2. MacOS
I have 2 columns of data by year. Column AA are the individual years from 1928-2023. Column AB is the data for that year. I'm currently using that data to randomize a Monte Carlo with =RANDBETWEEN(MIN(ab),Max(AB)) [I know the syntax isn't exact but you should get my point]

What I'd like to do is use a subset of the years to find my min/max values, (ex: 1946-2023). I'd like to do that by putting "1946" in cell "E1" and "2023" in cell "F1". Then I can change the range from which I pull my values directly by simply changing the year values in the 2 cells.

In my mind I need to (1) find the data cell to the right that matches the START year, (2) find the cell to the right that matches the STOP year, (3) use those cells in a range reference in the MIN() and MAX() functions

Pretty sure there's an indirect() function in there somewhere but I can't wrap my head around it.

Thanks
 
Try this:

Book1
DEFGH
1Start2018201044
2End2022201156
3Random93201238
4201397
5201424
6201583
7201611
8201760
9201839
10201928
11202093
12202161
13202294
14202316
15202466
Sheet1
Cell Formulas
RangeFormula
E3E3=LET(f,FILTER(H1:H15,(G1:G15>=E1)*(G1:G15<=E2)),LARGE(f,RANDBETWEEN(1,ROWS(f))))
 
Upvote 0

Excel Facts

Will the fill handle fill 1, 2, 3?
Yes! Type 1 in a cell. Hold down Ctrl while you drag the fill handle.
Edit: It works, my bad. When I created a named range for the the data the mouse must have slightly moved because I selected both columns instead of just the second column. I feel embarrassed.

Thanks for the help!!
 
Upvote 0
Edit: It works, my bad.

No problem. I'm glad we could help.

But are you sure your methodology is appropriate?

By using RANDBETWEEN(min, max) you're applying a uniform distribution between min and max, rather than looking at what the data is telling you.

Given the data in column A here, for example, are you happy with the simulated results?

Book10
ABC
1YearDataSim
211040
321262
431086
5410029
65777
761543
Sheet1
Cell Formulas
RangeFormula
C2:C7C2=RANDBETWEEN(MIN(B$2:B$7),MAX(B$2:B$7))
 
Upvote 0
I've taken it a different direction. I'm actually using the Mean and Standard deviation to randomize to create a gaussian distribution, Manages outliers way better
 
Upvote 0

Forum statistics

Threads
1,223,885
Messages
6,175,184
Members
452,615
Latest member
bogeys2birdies

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