MIN formula query

snjpverma

Well-known Member
Joined
Oct 2, 2008
Messages
1,584
Office Version
  1. 365
Platform
  1. Windows
I have a number in A10 which decides how many numbers should be considered for the below given MIN function.
For e.g. if A10 says 2 then the MININUM of first 2 numbers should be the output i.e MIN of A1 & C2).
If A10 is 3 then MININUM of first 3 numbers in the given formula i.e. MIN of A1 & C2 & D2.
How to do this?

=MIN(A1,C2,D2,D5)
 
Last edited:

Excel Facts

Who is Mr Spreadsheet?
Author John Walkenbach was Mr Spreadsheet until his retirement in June 2019.
The cells in question don't follow a pattern so you'll probably need to brute force it using IF:

Code:
=IF(A10=2,MIN(A1,C2),IF(A10=3,MIN(A1,C2,D2),MIN(A1,C2,D2,D5)))

WBD
 
Upvote 0
What if I get the cells in line like this A1:A6 ?

BTW, if I use Choose function it works. but I don't know how to put those values in the Choose function.

Like this
=MIN(CHOOSE({1,2,3},A1,C2,D2,D5))

Can the CHOOSE function be of any help?

Thanks for all the help
 
Last edited:
Upvote 0
If you have the values in A1:A6 and you have the number to consider in A10 then:

Code:
=MIN(A1:INDEX(A1:A6,A10))

WBD
 
Upvote 0
or…………

Array formula, where A10 =1, 2, 3, or 4

=MIN(CHOOSE(ROW(INDIRECT("1:"&A10)),A1,C2,D2,D5))

Regards
Bosco
 
Last edited:
Upvote 0
Thanks for your reply Bosco.

However, I would like to know how to create the highlighted sequence through a formula instead of manually typing it.
As shown below, the value for Choose function has a pattern (See the RED highlighted part below) i.e. first A1, then A1+A2, then A1+A2+A3 then A1+A2+A3+A4.
Also, the number to be subtracted i.e. B1 has a pattern (see the BLUE highlighted part) i.e. first B1*1, then B1*2 then B1*3 then B1*4...and so on.
Formula:
=MIN(CHOOSE(ROW(INDIRECT("1:"&A10)),A1-B1,A1+A2-2*B1,A1+A2+A3-3*B1,A1+A2+A3+A4-4*B1)

When it is just A1 then the B1 is multiplied by 1
When it is A1+A2 then the B1 is multiplied by 2
When it is A1+A2+A3 then the B1 is multiplied by 3
This is how the pattern isPlease advise on the same. Thanks for all the help that is provided on this forum.
 
Upvote 0
Try this:

Code:
=MIN(OFFSET($A$1,0,0,$A$10,1)-ROW(INDIRECT("1:"&$A$10))*$B$1)

Entered as an array formula.

WBD
 
Upvote 0
Wbd, thanks for the update.
However, I have got the solution
 
Upvote 0

Forum statistics

Threads
1,214,919
Messages
6,122,260
Members
449,075
Latest member
staticfluids

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