"There are some days when I think I'm going to die from an overdose of satisfaction."-Salvador Dali
Question #93039 posted on 04/21/2020 4:33 p.m.

Dear 100 Hour Board,

Are any of you Excel/Google sheets experts? I'm good enough at regular everyday tasks, but this one has me stumped as I don't know how to phrase my search....

Say I have a task that lasts 8 minutes. I want to play a set of songs everytime I do that task, with the set lasting 8 minutes. I can go to my playlist and choose two 4-minute songs or four 2-minute songs, but what if I want to include a song that has an uneven time?

Is there a way to take a list of times for the songs I have, and have excel or google spreadsheets make groups that equal 8 minutes?

-Zwerg Zwei


Dear ZZ,

This goes into combinatorics, which I have to admit were never really my favorite. I haven't the faintest idea of how you would do this in excel, but a naive solution would be to iterate through all possible time combinations given a set list of songs. For a much better solution, use dynamic programming to determine song groups.This seems like a simplified version of the knapsack problem, so if you google solutions to the knapsack problem in vba, you can probably modify it to fit your needs here.



Dear ZZ Top,

If you listen to Africa by Toto and then Never Gonna Give You Up by Rick Astley it takes EXACTLY 8 minutes. Coincidence?

No. I think the universe is trying to tell us all that this is the only playlist we need.