Getting top 3 values

Again posting this question which has not been resolved yet. I have 2 sets of question one set with integer type having 15 question in it asking for percentage sharing on the basis of 100% the second set of question which is a multi select with 15 choices in it.
image type name label
begin_group q2 2. What is theapprox. proportion of sales among the companies you are currently dealing with?
integer q2_1 Tata Rallis
integer q2_2 Bayer
integer q2_3 Syngenta
integer q2_4 UPL
integer q2_5 Corteva
integer q2_6 BASF
integer q2_7 Indofil
integer q2_8 Cheminova
integer q2_9 Adama
integer q2_10 Excel
integer q2_11 Dhanuka
integer q2_12 Godrej
integer q2_13 PI
integer q2_14 ${q1_oth1}
integer q2_15 ${q1_oth2}
end_group

select_multiple q5 q5 Tata Rallis

I want to show only the choices in q5 with top 3 values in q2. Like for eg if Tata Rallis, Sygenta and UPL has the top 3 values then q5 will only display these 3 choices. If duplicates it will include both the choices in the list. I am attaching the sample form for your reference.aNWGu8ym4Sy2aDjyhzuH9g (1).xls (49 KB)

Hi
This is related to a different topic posted on this thread kindly confirm if this addresses your issues.

Yes this is the issue of top 3 values which has not been resolved yet.

Hello Stephane,

Your XLSForm selects nicely the top answer. However, I failed to see the way to get the second and third choice. I do not see how I can remove the top value from a list. I also tried a nested if but did not get a solution.

Curious,

Jozef

Hi Jozef,
Glad to know that it worked for you for the maximum (1st) value. Normally we would present implementation of logic as an example and have the users try to play the logic to fully answer their form design queries. Have you tried doing it on your own by adapting the logic I had initially prepared for maximum? Kindly try and then point out specific areas where other community members can contribute into if you are stuck.

Stephane

Hi Stephane,

Indeed I tried and tried again upon your reply. I think I found a logic to identify the second and third highest values. The formulas are nearly not as neat as yours. I always need to check if a value is not the highest or second highest value.

Attached is the file.

Ranking to Select-js.xlsx (13.1 KB) .

Best regards,

Jozef