Using minimum value to get column #

Danish_dan

New Member
Joined
Mar 7, 2014
Messages
4
A am doing a queuing problem, with a single queue and multiple servers. I am currently looking for a function which will find the smallest number in a matrix and return the corresponding column number.

I want to find the server to take on the next customer, so I need to find the lowest "end service" time and get a corresponding server number, this could be the column.

Hope you can help :)
 

Excel Facts

Which lookup functions find a value equal or greater than the lookup value?
MATCH uses -1 to find larger value (lookup table must be sorted ZA). XLOOKUP uses 1 to find values greater and does not need to be sorted.
Hi,

Will the smallest number in that range be unique? If not, what should be the outcome?

Regards
 
Upvote 0
Yes the smallest number in the matrix will be unique, so the formula should return the value or name of the column for the cell which includes the smallest value.
 
Upvote 0
In that case, with e.g your matrix in A1:J10 (with headers in row 1):

=INDEX(A1:J1,SUMPRODUCT((A2:J10=MIN(A2:J10))*((COLUMN(A2:J10)-MIN(COLUMN(A2:J10))+1))))

Regards
 
Upvote 0
Thank you for the reply I cannot seem to make it work what we have so far:
Col1 Col2 Col3 Col4 Col5
0 0 0 0
10 0 0 0
0 20 0 0
0 0 25 0
0 0 0 30

So what we would like in Col5 would be the returning number of the matrix for where we have come to, so in Col5 Row2 it should find the min number and give the corresponding value of the matrix A2:D2, so in this case it would not matter which one it chose since they are all 0. In Col5 Row 3 it should chose the lowest number in the matrix A2:D3 and give either the value 2, 3 or 4 as they are the lowest (value 0)
 
Upvote 0
Hi again,

Not sure I understand. You said "Yes the smallest number in the matrix will be unique" but now you seem to be presenting an example in which zero appears many times. Can you clarify?

Also, you say that the result entered in row 2 should be for A2:D2, and that for row 3 for A2:D3 (not A3:D3, as I might have guessed). Is this correct? So the result for row 4 should be based on A2:D4, that for row 5 on A2:D5, etc.? The first reference always remains fixed at 2?

What are your expected results for each of the rows in the example you give?

Regards
 
Last edited:
Upvote 0
Rows/colCol1Col2Col3Col4Col5
Row11234
Row20000
Row310000
Row402000
Row500250
Row600030
Row725 (10+15)000
Row8
Row9
Row10

<tbody>
</tbody>

Yep sorry the smallest value will not be unique as it is 0, sorry about that. The numbers in the matrix resemble service times/or server finish time, so the first customer arrive in time 0 and go to counter 1 and take the time of 10. The second customer go to counter 2 and is finished in time 20.
So in col 5 I would like to get the corresponding col to the smallest value. In row5col5 it should be the value 4 (as counter 4 has the lowest value which is 0, where as the others have a value of 10, 20 and 25).

Hope it is clear and you still have time to help :)
 
Upvote 0
Sorry. Still not clear! Could you tell me all of your expected results in column 5 of that table?

Regards
 
Upvote 0

Forum statistics

Threads
1,216,075
Messages
6,128,657
Members
449,462
Latest member
Chislobog

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