Formula for SMALLEST VALUE not working

hrayani

Well-known Member
Joined
Jul 23, 2010
Messages
1,539
Office Version
  1. 2016
Platform
  1. Windows
Hello friends,


I am using this formula to
=SMALL(IF(orders_ref=$C$1,orders_po,""),1)

to get the smallest value in the range. Like 1st to 5th Smallest value.

Here is a sample data

[TABLE="width: 171"]
<tbody>[TR]
[TD]95822[/TD]
[TD]123[/TD]
[/TR]
[TR]
[TD]95825[/TD]
[TD]123[/TD]
[/TR]
[TR]
[TD]95828[/TD]
[TD]123[/TD]
[/TR]
[TR]
[TD]95830[/TD]
[TD]123[/TD]
[/TR]
[TR]
[TD]95831[/TD]
[TD]123[/TD]
[/TR]
[TR]
[TD]40041541[/TD]
[TD]127[/TD]
[/TR]
[TR]
[TD]40043227[/TD]
[TD]127[/TD]
[/TR]
[TR]
[TD]40042045[/TD]
[TD]129[/TD]
[/TR]
[TR]
[TD]12943122 A[/TD]
[TD]130[/TD]
[/TR]
[TR]
[TD]12943122 B[/TD]
[TD]130
[/TD]
[/TR]
</tbody>[/TABLE]

I am getting the result for Ref # 123 or 127... But the formula is not giving the result for
Ref # 130..... May be coz the Numbers in Column A against Ref # 130 contains some
alphabets with them...

Pls if anyone can let me know how to solve this issue???

Regards,

Humayun
 
Thanks Sanjeev for the reply.

Your formula is working fine with the sample data.. But i dont know why i am not able to get it to work with my original data

Here is your formula

=IFERROR(INDEX($A$1:$A$10,SMALL(IF(C$1=$B$1:$B$10,ROW($A$1:$A$10),""),ROW())),"")

This is where i changed it.

=IFERROR(INDEX(orders_po,SMALL(IF(C$1=orders_ref,ROW(orders_po),""),ROW())),"")

Any Idea ???

Am i doing anything wrong.... let me know that the named ranges starts from Row 2 till Row 1000
 
Upvote 0

Excel Facts

What is the fastest way to copy a formula?
If A2:A50000 contain data. Enter a formula in B2. Select B2. Double-click the Fill Handle and Excel will shoot the formula down to B50000.
Try =IFERROR(INDEX(orders_po,SMALL(IF(C$1=orders_ref,ROW(orders_ref)-MIN(ROW(orders_ref))+1,""),ROW())),"") entered as an array formula
 
Upvote 0
No dear, still not working...

its not giving the first smallest value.... its starting from the 2nd Smallest value..

Any Idea ???
 
Upvote 0
The unqualified ROW() is not a very rigorous choice for SMALL's k parameter. What's more, the part ROW($A$1:$A$10) will only work if your data begins in row 1.

Better is:

=IFERROR(INDEX(orders_po,SMALL(IF(C$1=orders_ref,ROW(orders_po)-MIN(ROW(orders_po))+1),ROWS(A$1:A1))),"")

though unless the number of expected returns is quite small then I would also replace the IFERROR here with a more efficient set-up.

https://superuser.com/questions/812...-and-return-all-multiple-corresponding-values

Regards
 
Upvote 0
Will enter 130 in C1

Answer should be (12943122 A) in D1 & (12943122 B) in D2.... Rest D3:D5 should show blank as there are only two values against Ref # 130


Right.


Book1
ABCDE
1itemvalue130bottom
2958221235
395825123130
4958281233
595830123top itemstop values
69583112312943122 A130
74004154112712943122 B130
840043227127Humayun140
940042045129
1012943122 A130
11Humayun140
1212943122 B130
13
Sheet1


In D3 control+shift+enter, not just enter:

=LARGE(IF(B2:B12>=C1,B2:B12),MIN(COUNTIFS(B2:B12,">="&C1),D2))

In D4 control+shift+enter, not just enter:

=SUM(IF(B2:B12>=LARGE(IF(B2:B12>=C1,B2:B12),MIN(COUNTIFS(B2:B12,">="&C1),D2)),1))

In D6 control+shift+enter, not just enter, and copy down:

=IF($E6="","",INDEX($A$2:$A$12,SMALL(IF($B$2:$B$12=$E6,ROW($B$2:$B$12)-ROW($B$2)+1),COUNTIFS($E$6:E6,E6))))

In E6 control+shift+enter, not just enter, and copy down:

=IF(ROWS($G$6:G6)<=$D$4,SMALL(IF($B$2:$B$12>=$D$3,$B$2:$B$12),ROWS($G$6:G6)),"")
 
Upvote 0
You're welcome, though take note of my point about IFERROR, which can be resource-heavy if the number of cells to which the formula is copied significantly exceeds the expected number of returns.

The link in my previous post demonstrates an alternative set-up with a single helper cell which avoids this potential issue.

Regards
 
Upvote 0
You're welcome, though take note of my point about IFERROR, which can be resource-heavy if the number of cells to which the formula is copied significantly exceeds the expected number of returns

Well, at this point of time number of cells to which the formula is copied are very few.
But, thanks for letting me know.

Regards,

Humayun
 
Upvote 0
Thanks Aladin for your Solution. I guess i will stick to the formula which XOR LX provided.
Its much simpler.....

And sanjeev - thanks to you too.
 
Upvote 0

Forum statistics

Threads
1,224,823
Messages
6,181,181
Members
453,022
Latest member
Mohamed Magdi Tawfiq Emam

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