[Solved] Formula to find week numbers from the Total [closed]

You could take a bitwise AND & with the day value and take this day. const days = { Monday: 1, Tuesday: 2, Wednesday: 4, Thursday: 8, Friday: 16, Saturday: 32, Sunday: 64 }, getDays = value => Object.keys(days).filter(day => value & days[day]); console.log(getDays(127)); // All Days console.log(getDays(80)); // Friday, Sunday console.log(getDays(7)); // Monday, Tuesday, … Read more

[Solved] Macro in Excel to Copy a Worksheet (by referencing every cell)

If you want to avoid the clipboard may I suggest R1C1 formula format: Sub fillsheet() Dim ows As Worksheet Dim tws As Worksheet Dim rng As Range Set ows = Worksheets(“Sheet1”) Set tws = Worksheets(“Sheet2”) Set rng = ows.UsedRange tws.Range(rng.Address()).FormulaR1C1 = “='” & ows.Name & “‘!RC” End Sub 1 solved Macro in Excel to Copy … Read more

[Solved] How to divide items equally in 4 boxes? [closed]

Create a function that gets a product weight and returns a bag number – the one which has the least free space that’s still enough to fit. Put it in the bag. Repeat until done. $bags = array(60,80,20,10,80,100,90); $containers = array(1=>100,2=>100,3=>100,4=>100); // number -> free space $placement = array(); rsort($bags); // biggest first – usually … Read more