SMALL Formula not Working with Index and Match

marvin jones

Board Regular
Joined
Mar 16, 2016
Messages
86
Hi All,

I have the formula below which looks at the smallest 3 values in a pivot table (column CT) and returns with the employee name (column CS)

=IF(ISERROR(INDEX('Bradford - Data'!$CS:$CS,MATCH(SMALL('Bradford - Data'!$CT:$CT,1),'Bradford - Data'!$CT:$CT,0))),"TBC",(INDEX('Bradford - Data'!$CS:$CS,MATCH(SMALL('Bradford - Data'!$CT:$CT,1),'Bradford - Data'!$CT:$CT,0))))

However, this formula returns with the same name 3 times. I don't have this issue when applying the LARGE formula.

Is this to do with there being a series of no values in the pivot column (due to the employee not working)?

What is an alternative formula to get the smallest values?

Thanks,
 
Ah - your last formula changed the names to 3 different ones. What I'd like is for 0.00% to be included as that is the optimum score to be achieved, just not the blank/no value cells. Thanks Aladin, i do appreciate it.

I can see that your formula has picked out a name with no value and then 2 other names below this first name in the pivot. One of the names has a much higher score (37%)
 
Last edited:
Upvote 0

Excel Facts

When they said...
When they said you are going to "Excel at life", they meant you "will be doing Excel your whole life".
Morning Aladin,

Your formula works! I tried it again this morning and it is now returning the 3 smallest values - brilliant, thank you!

My only other thought is that we have limited the columns to CT740, CU740, etc..It is likely that as more data populates the pivot the column will extend to further than CT740. Can the formula accommodate this increase?

Thanks again.
 
Upvote 0
Morning Aladin,

Your formula works! I tried it again this morning and it is now returning the 3 smallest values - brilliant, thank you!

My only other thought is that we have limited the columns to CT740, CU740, etc..It is likely that as more data populates the pivot the column will extend to further than CT740. Can the formula accommodate this increase?

Thanks again.

That's great. In what follows we create a dynamic set up...


Book1
CSCTCU
6jon5
7han3
8lon457.42%
9dan3
10can2
11ben153.00%
12ron4
13daphne0.00%
14
Bradford


Note that the sheet name is shortened to just Bradford (which is a good idea).


Book1
ABC
113
243
3bendaphne
4canben
5hanlon
6dan
7
8
9
10
Sheet1


In A1 just enter:

=MATCH(REPT("z",255),Bradford!CS:CS)

In A2 just enter and copy across:

=COUNTIFS(Bradford!CT:CT,"<="&SMALL(Bradford!CT:CT,MIN(3,COUNT(Bradford!CT:CT))))

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

=IF(ROWS(A$3:A3)>A$2,"",INDEX(Bradford!$CS$6:INDEX(Bradford!$CS:$CS,$A$1),SMALL(IF(ISNUMBER(Bradford!CT$6:INDEX(Bradford!CT:CT,$A$1)),IF(Bradford!CT$6:INDEX(Bradford!CT:CT,$A$1)=SMALL(Bradford!CT$6:INDEX(Bradford!CT:CT,$A$1),ROWS(A$3:A3)),ROW(Bradford!CS$6:INDEX(Bradford!CT:CT,$A$1))-ROW(Bradford!CS$6)+1)),SUM(IF(SMALL(Bradford!CT$6:INDEX(Bradford!CT:CT,$A$1),ROW(Bradford!CS$6:CS6)-ROW(Bradford!CS$6)+1)=SMALL(Bradford!CT$6:INDEX(Bradford!CT:CT,$A$1),ROWS(A$3:A3)),1)))))
 
Upvote 0
I think i got confused by columns and rows in the pivot in my previous question. Would this formula work if CT741, CT742 etc.. was the extension in the pivot, rather than CT, CU, CV being the extension in the pivot?
 
Upvote 0
I think i got confused by columns and rows in the pivot in my previous question. Would this formula work if CT741, CT742 etc.. was the extension in the pivot, rather than CT, CU, CV being the extension in the pivot?

Yes. The set up expands and/or shrinks rowwise.
 
Upvote 0
Great, thank you.

Would i ever need to amend the "z" or 255 part in the REPT formula? What does it do within the formula as a whole?
 
Upvote 0
Great, thank you.

Would i ever need to amend the "z" or 255 part in the REPT formula? What does it do within the formula as a whole?

You don’t need to adjust it at all. lt creates a string that lexically would sort as the last item in an ascending order.
When the match function uses this as look up value for looking at a text range, it will pick out the position (row) of the last text value from that range. That position is effectively the last row in which there is data.
 
Upvote 0

Forum statistics

Threads
1,215,032
Messages
6,122,770
Members
449,095
Latest member
m_smith_solihull

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