Return poisition of the smallest with criteria.

eduzs

Well-known Member
Joined
Jul 6, 2014
Messages
704
Office Version
  1. 2019
  2. 2010
Platform
  1. Windows
I have four values in P Q R and S columns (int numbers).
I need a formula that returns the position (match) of the smallest value, BUT when there's two or more values with this same smallest value??? In this case I want it to return a aleatory position between those smallest equal values.
Without macro will be better.
Examples:
10,20,15,9 returns 4 (position of the smallest).
40,2,30,8 returns 2 (position of the smallest).
3,3,7,5 returns 2 (aleatory between 1 and 2).
10,4,4,4 returns 3 (aleatory between 2,3,4).
Thanks.
 
Just one last question. Are there any advantages beyond the simplicity in using non-array formulas? As performance, smaller file size, etc.
In some cases array formulas may consume more resources and have slower calculation times than non-array formulas, but that is not a blanket rule.

In this case there really isn't that distinction anyway. The AGGREGATE formulas and PGC's non-CSE formula still use an array in their calculation so they are really still array formulas - hey just doesn't require the CSE entry.

I timed (twice) the calculation of each column of 5 formulas below with the results in seconds in rows 8 & 9. Those speed results would not cause me to choose one formula over the other.

Excel Workbook
PQRSTUVWXYZ
1PS4 cols onlyPSExpandablePGCExpandablePGC4 cols onlyPGCnon-array
2102015944444
340230822222
4337522211
51044432342
6337321424
7
80.001830.001830.001870.001870.00183
90.001820.001840.001850.001850.00184
Smallest
 
Upvote 0

Excel Facts

Repeat Last Command
Pressing F4 adds dollar signs when editing a formula. When not editing, F4 repeats last command.
Nice! Can you tell me the code to calculate the execution time?
I did some tests here it's a 459 lines and found that your AGREGATE or pgc01 X2 small were the fastest.
 
Upvote 0

Forum statistics

Threads
1,215,222
Messages
6,123,704
Members
449,118
Latest member
MichealRed

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