# How to Show Top 03 Categories

**swasb**Hi, we want to create a quiz / survey form in which we have 40 questions, choices of this from is having 0-4 value (radio button). These 40 questions fall under 7 different categories and sum of these questions are divided into these categories like.

1. Adrenals

2. Hormonal

3. Fatty Acids

4. Gut

5. Toxicity

6. Inflammation

7. Immune

Questions are like:

1. 1. Crave fatty or greasy foods (Essential Fatty Acids) (

2. 2. Mood swings with PMS (Hormonal)

Answers are:

0 – Never

1 – Rarely Occurs

2 – Occurs Monthly

3 – Occurs Weekly

4 – Occurs Daily

We want to show top 03 categories (having highest sum) in thanking you page.

Kindly guide for its procedure.

**Charlie**Hi,

Unfortunately, we do not have a direct feature or functionality where you can automatically order things.

However, we do have a a math function in our Form Calculation widget which is called "nth()" function that allows you to get the nth highest value.

Example #1:

= nth(nth value, score 1, score 2, score 3, score 4)

= nth(1, 10, 8, 6, 1)

= 10 is the 1st highest value

Example #2 for 2nd highest value:

= nth(nth value, score 1, score 2, score 3, score 4)

= nth(2, 10, 8, 6, 1)

= 8 is the 2nd highest value

Here's an example form: https://form.jotform.com/70401134466952. You can clone it to see how it is setup: https://www.jotform.com/help/42-How-to-Clone-an-Existing-Form-from-a-URL

Here's how it is setup:

1. First, I have 1 question for each category, I used a radio button field for this. Here's a guide on how you can assign calculation value on them: https://www.jotform.com/help/301-How-to-Assign-Calculation-Value

2. Now I will use Form Calculation widgets to calculate the score for each category:

In the Form Calculation widget setup, you can perform calculations, in my case, I only have 1 question for each category so I don't really calculate anything.

To learn more about calculation, you can check the following guides:

https://www.jotform.com/help/259-How-to-Perform-Form-Calculation-Using-a-Widget

https://www.jotform.com/help/268-Conditional-Logic-Inserts-Text-Calculation-Into-A-Field

3. Now I will setup another 2 Form Calculation widget that will get the 1st and 2nd highest score on all of the category totals:

4. This is where we will use the nth() function, you can find it by clicking the "..." button. Here's a screencast to where to find it:

Here's an example on "Top 1 Score":

For other math functions, you can check this as a reference: https://www.jotform.com/help/267-Form-Calculation-Math-Function-Reference

5. However, the limitation that this has is for scores with the same value, they will not be in an order of 1st, but instead 1st and 2nd despite of having the same value. Another limitation is how we can output the category rather than the score itself. We can use the Conditional Logic feature but it may be tricky, you can see on my live form the limitations of this.

Another possible solution is by using custom scripts, if you are a developer or a programmer, you can download the form's full source code then create your own script that would order the results or calculation.

I hope that helps.

**tracypdex**Hi, thanks for such a detailed help, can you please tell me how to show naem of the calculation widget along with its score ?

- JotForm Support
**Kevin_G**@tracypdex,

If you're referring to display the widgets in your form, then you could check if they're hidden and turn off this option so they're displayed when previewing/filling out the form:

Hope this helps.

- JotForm Support
**Nik_C**