Love this. How can I set the sort to run on a date column? My date field is displayed as "Fri, Apr 9, 2021". Using what is demonstrated in your [AWESOME] video, my sheet sorts with blanks on top, then day of week as text. Would love to know if you already have this in another video.
This is a great video! Thanks so much. I am looking for this as well. I need to sort an array by multiple columns. Hoping you already have a video on that.
Can I ask why why is this done so complicated? Couldnt it be done just with single callback function in function sort? Is it because of procesor usage or just for educational purposes so you could show us more functions? Thank you. By the way the channel is really great. I didnt find better source for this topic (usage of javascript in google sheets).
Sure. Since the algorithm has been modified to convert everything to lowercase, then A=a and B=b. Therefore, it treats them as being equal and the function returns "0", which means that the order of the items is not changed. So it really depends on the physical location of the items in the array. As it is, this will always be the case when implementing this solution. You would need to look at the ASCII values of the items and compare them instead.
Boss: Could you sort this list of alphanumeric items for me by noon? Me: Sure Boss ... No problem! Noon it is. I'll use this handy-dandy JavaScript routine to solve the problem. --------- 3 days later ---------------------- Me: Here you go, Boss. It's all sorted ... well, sort of. Boss: I thought you said you would have it done by noon. Me: You didn't say on which day.