SMALL kth "2nd instance" ?

seanh1016

Active Member
Joined
Feb 16, 2003
Messages
254
Is it possible for SMALL to return the second instance of, say, the 2nd smallest value in a list? For example, if I have 2 birthdays on the same say, I'd like to somehow return one with small(range,2) and the other with small(range,2).

I know this is similar to vlookupnth. But I'm trying to avoid using vlookupnth.
 

Excel Facts

How to show all formulas in Excel?
Press Ctrl+` to show all formulas. Press it again to toggle back to numbers. The grave accent is often under the tilde on US keyboards.
My understanding of how SMALL() works is that if small(range,2) and small(range,3) are identical, they both will return in order of rank as the "k" value increases.
Excel Workbook
ABCD
1Dates**in Order
21/15/2009**1/15/2009
31/16/2009**1/16/2009
41/17/2009**1/16/2009
51/18/2009**1/17/2009
61/16/2009**1/18/2009
71/20/2009**1/18/2009
81/18/2009**1/20/2009
91/22/2009**1/22/2009
101/23/2009**1/23/2009
111/24/2009**1/24/2009
Sheet4


That one formula copied down DOES appear to bring in the multiple instances of each duplicated date.

So, since SMALL already works the way you want, is this the actual problem or are you having trouble grabbing the associated NAMES with these duplicated dates?
 
Upvote 0
Assuming it is the names required then try like this:
Book2
ABCDEFG
1NameBirthdayBirthdayName
2aaronadams26-Oct-87123-Dec-72charliebritton
3alicearchibald25-Jul-83208-Sep-77benatkinson
4benatkinson08-Sep-77308-Sep-77callumbarnes
5callumbarnes08-Sep-77408-Sep-77dougburton
6carolbridges18-Nov-94511-Mar-78fionacave
7charliebritton23-Dec-72
8davebrown09-May-80
9dougburton08-Sep-77
10eddiecarter26-Nov-83
11fionacave11-Mar-78
12
Sheet1


Formula in E2 copied down

=SMALL(B$2:B$11,D2)

formula in F2 confirmed with CTRL+SHIFT+ENTER and copied down

=INDEX(A$2:A$11,SMALL(IF(B$2:B$11=E2,ROW(B$2:B$11)-ROW(B$2)+1),COUNTIF(E$2:E2,E2)))
 
Upvote 0
If you have a list of names and their DOBs then you could do something like this:
birthdays test.xls
ABCDEFGHIJ
1NameDOBdaysuntilNext5birthdaysfrom8March2009
2KofiAnnan08Apr193831
3TonyBlair06May195359DateDaystogoNameAge
4GordonBrown20Feb195134910Mar20092EdwardWindsor45
5GeorgeWBush05Jul194611912Mar20094JackKerouac87
6barryhoudini26Oct196423212Mar20094LizaMinnelli63
7JackKerouac12Mar1922415Mar20097SylvesterStallone65
8MartinLutherKing15Jan192931308Apr200931KofiAnnan71
9DalaiLama06Jul1935120
10AngelMerkel17Jul1954131
11LizaMinnelli12Mar19464
12BarackObama04Aug1961149
13NicolasSarkozy28Jan1955326
14SylvesterStallone15Mar19447
15EdwardWindsor10Mar19642
16
birthdays2


I used a "helper" column in column C. Formula in C2 is as follows copied down:

=DATE(YEAR(B2)+DATEDIF(B2,F$1-1,"Y")+1,MONTH(B2),DAY(B2))-F$1

F1 contains today's date generated by the formula =TODAY() and then F1 is custom formatted as

"Next 5 birthdays from "d mmmm yyyy

F4 and G4 have these formula copied down

=F$1+G4
=SMALL(C$2:C$20,ROWS(F$4:F4))


H4 contains this formula

=INDEX(A$2:A$20,SMALL(IF(C$2:C$20=G4,ROW(C$2:C$20)-ROW(C$2)+1),COUNTIF(F$4:F4,F4)))

confirmed with CTRL+SHIFT+ENTER and copied down

I4 contains this formula copied down

=DATEDIF(VLOOKUP(H4,A$2:B$20,2,0),F$1-1,"y")+1

Note: formulas might not all work correctly until all of them have been added

Does that help at all?
 
Upvote 0

Forum statistics

Threads
1,214,824
Messages
6,121,784
Members
449,049
Latest member
greyangel23

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