Return a user specified number of cell values to a comma list randomly

kodarr

New Member
Joined
Apr 8, 2024
Messages
1
Office Version
  1. 365
Platform
  1. Windows
I have variable lists that will have 200–1000 values in them. ex:

1 Reliable
2 Practical
3 Responsible
4 Organized
5 Detail-oriented
6 Logical
7 Hardworking
8 Dedicated
9 Honest
10 Loyal
etc...

The user will be able to put a number in a cell and a different cell will spit out x number of these traits in a comma list. I know how to do this in an if else chain with VLookup if I know how many things I need to return.

However, I can't find any way to do this with the user choosing the number of items since there is no loop function that I can find to repeat the VLookup that many times. If possible I would also like that it never gives the same trait twice but I can live with it if that is not possible.

Is this possible without an if then else repeating the same code over and over for any value the user may put in the number of traits they want?

So if the cell with number of values is B3 and it has a 3 in it. Then the cell displaying the traits which would have the looping vlookup may display "Loyal, Efficient, Patient"

Is there a way to accomplish this? It seems something that should be simple but I can't find anything online about doing something like this.
 

Excel Facts

Can you sort left to right?
To sort left-to-right, use the Sort dialog box. Click Options. Choose "Sort left to right"
How about:

david763.xlsx
ABCD
1ListCountSelection
2Reliable3Logical, Honest, Dedicated
3Practical
4Responsible
5Organized
6Detail-Oriented
7Logical
8Hardworking
9Dedicated
10Honest
11Loyal
12
13
Sheet8
Cell Formulas
RangeFormula
D2D2=LET(rng,A2:A20,a,COUNTA(rng),s,SEQUENCE(a),b,SORTBY(s,RANDARRAY(a)),TEXTJOIN(", ",1,INDEX(rng,INDEX(b,SEQUENCE(C2)))))
 
Upvote 0

Forum statistics

Threads
1,215,200
Messages
6,123,612
Members
449,109
Latest member
Sebas8956

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