aaronsupremeworks.com Posted October 4, 2017 Share Posted October 4, 2017 I have a customer that is having a dinner. I was hoping to get some help with a rule that would count the different meal choices in the different columns (one column for each guest) and return a result something like: 1 Steak, 1 Halibut Sample data attached. thanks AaronOct 12th RSVP Meal Choices by Name.xlsx.zip Quote Link to comment Share on other sites More sharing options...
step Posted October 4, 2017 Share Posted October 4, 2017 Maybe this would do the trick: var result = []; var meals = {}; var fields = ["Guest Entree", "2nd Guest", "3rd Guest", "4th Guest", "5th Guest", "6th Guest", "7th Guest"] .map(Field).filter(String).forEach(function(s){ meals[s] = meals[s] + 1 || 1 }); for (var mealChoice in meals) result.push((count = meals[mealChoice]) + ' ' + mealChoice + (count > 1 ? 's' : '')); return result.join('<br/>\n'); Quote Link to comment Share on other sites More sharing options...
aaronsupremeworks.com Posted October 6, 2017 Author Share Posted October 6, 2017 Thanks Step! That worked great! Quote Link to comment Share on other sites More sharing options...
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.
Note: Your post will require moderator approval before it will be visible.