# Order of follow up questions based on previous numeric entry grid

Good morning!

I don't know how easy, or possible, this is, but thought I would inquire.

I have a grid question requesting spending information, each row is a different region of the state. There is a subsequent follow up grid for each of the five regions, that is another grid asking for spending by community. These region specific follow up grid questions are all on their own page. What I would like is for the order of these follow up grids to be shown in the order of spending amount in the first grid.

So, if a respondent enters \$1,000 for region 1, and \$4,000 for region 2, they would only see these two follow up questions (I can acheive this with skips, not a problem) - but would like them to be asked about region 2 first, then region 1, since they spent the most in region 2.

Sound like something possible?
asked Nov 20, 2013

Or you can use the much simpler ADDSORTED('Q1_r1') for greatest answers on first to smallest at the end, or ADDSORTED('Q1_r1', 1) for ascending order in a constructed list.
answered Nov 20, 2013 by Gold (23,415 points)
I think Mike means ADDSORTED('Q1_r1',0) for greatest answers on first to smallest.
here is the solution.

You have to create dummy list ( Let's say NumberForRand) with the value 1 to 5. Now you need to create one constructed list (ForRand) which has parent list 'NumberForRand' and code for constructed list would be ( I am assuming your grid question with five region would be Q1)

[perl]
Begin Unverified Perl
my \$sum1=VALUE('Q1_r1_c1');
my \$sum2=VALUE('Q1_r2_c1');
my \$sum3=VALUE('Q1_r3_c1');
my \$sum4=VALUE('Q1_r4_c1');
my \$sum5=VALUE('Q1_r5_c1');

my @sum_value;
my @sum_min;

\$sum_value=\$sum1;
\$sum_value=\$sum2;
\$sum_value=\$sum3;
\$sum_value=\$sum4;
\$sum_value=\$sum5;

\$sum_value="1";
\$sum_value="2";
\$sum_value="3";
\$sum_value="4";
\$sum_value="5";

@sum_min=sort{\$b-><=>\$a->}@sum_value;