Business
Jobs
  • About Us
  • Solutions
    • Job Postings
      Post your job and receive qualified candidates in 48h.
    • Candidate Assessments
      500+ technical and psychological tests, plus anti-fraud.
    • Headhunting
      Tailor-made executive search from start to finish.
    • Payroll + EOR
      Payroll dispersal and EOR across 15+ LATAM countries.
  • Pricing
  • Jobs

0

116
Views
Selecting Multiple Values from a Dropdown List in Google Spreadsheet and Printing Alphabatically

I'm following this link Selecting Multiple Values from a Dropdown List in Google Spreadsheet, it works very well. For Example if i have dropdown with three values like "Red, Black, Green" , and i select "Red & Black" it prints Red & Black perfectly fine, now if i select "Black & Red" it prints respectively. The problem now is if i filter this column in spreadsheet these "Red & Black", "Black & Red" are taken as seperate values which does not make sense because both are same. How can it be done where if i select in any manner it should print alphabattically? any leads? thanks.

about 4 years ago · Juan Pablo Isaza
1 answers
Answer question

0

Here is the possible solution.

You can add this function a the end of multi-select.gs file:

function sort_contents() {
  var range = SpreadsheetApp.getActiveRange();
  var values = range.getValues();
  var sorted_values = values.map(row => [row[0].split(',').sort().join(',')]);
  range.setValues(sorted_values);
}

Add this function into the dialog.html file, after the function function reset() {...}:

function sort_contents() {
  google.script.run.withSuccessHandler(x=>{}).sort_contents()
}

And add one more button in the dialog.html:

<input type="button" value="Sort" onclick="sort_contents()" />

After that you will have the button 'Sort' that will sort the contents of selected cell (and cells, you can select several cells) alphabetically. So you will able to sort 'Red, Black' into 'Black, Red' anytime.

enter image description here

about 4 years ago · Juan Pablo Isaza Report
Answer question
Find remote jobs

Discover the new way to find a job!

Top jobs
Top job categories
Business
Post vacancy Pricing Sales
Legal
Terms and conditions Privacy policy
© 2026 PeakU Inc. All Rights Reserved.
Andres GPT
Show me some job opportunities
There's an error!