answers = [e1, e2, e3, e4, e5, e6, e7] mapper = { 'Less than 250': 0, '250 to 499': 250, '500 to 999': 500, '1000 to 4999': 1000, '5000 to 19,999': 5000, '20,000 or more': 20000, 'Not Provided': 0, '0': 0, '1-9': 1, '10-49': 10, '50-249': 50, '250-999': 250, '250+': 250, '1000+': 1000, 'Less than 1000': 0, '1001-5000': 1001, '5001-10000': 5001, 'More than 10000': 10000, } isNumber = (n) -> return not isNaN(parseFloat(n)) and isFinite(n) mapAnswer = (answer) -> if answer of mapper return mapper[answer] if isNumber answer return answer return 0 mappedAnswers = answers.map (answer) -> mapAnswer(answer) mappedAnswers.reduce (a,b) -> Math.max a, b