Google Sheets – How do I add each Sunday in succession with 3 empty cells under each date?

Solution with a formula:

    A1 : =ArrayFormula(if(
                          mod(ROW(A1:A100),4)=1,
                          text((round(ROW(A1:A100)/4)*7)+43730,"dddd mmm yy")
                         ,)
                     )

Solution with Drag & Drop

  1. Enter the data in the cells: A1 is the first sunday,
    A5 is the second with this formula =A1+7
    A9 is the third: =A5+7
  2. Mark the cells A5:A12, In the lower right corner you will see a small blue box.
  3. Drag the blue box down or across with any number of cells.

Result:

formula
solution with forumula
Pull
In front
to

Performance algorithm for competing cells with 0s and 1s. Can it be made faster?

I am working on an exercise algorithm problem that reads as follows:

There are eight houses that are represented as cells. Every day, the houses compete with neighboring ones. 1 stands for an "active" house and 0 for an "inactive" house. If the neighbors on either side of a particular home are either both active or both inactive, that home will be inactive the next day. Otherwise it will be active. For example, if we had a group of neighbors (0, 1, 0), the house at (1) would become 0 because both the house on the left and the one on the right are inactive. The cells at both ends have only one adjacent cell, so assume that the unoccupied space on the other side is an inactive cell.

Even after updating the cell, you must remember the previous status when updating the others so that the status information for each cell is updated at the same time.

The function takes the series of states and a number of days and should output the state of the houses after the specified number of days.

Examples:

    input: states = (1, 0, 0, 0, 0, 1, 0, 0), days = 1
    output should be (0, 1, 0, 0, 1, 0, 1, 0)
    input: states = (1, 1, 1, 0, 1, 1, 1, 1), days = 2
    output should be (0, 0, 0, 0, 0, 1, 1, 0)

My solution:

def cell_compete(states, days):
    for _ in range(days):
        prev_cell, next_cell, index = 0, 0, 0
        while index < len(states):
            if index < len(states) - 1:
                next_cell = states(index + 1)
            elif index == len(states) - 1:
                next_cell = 0
            if next_cell == prev_cell:
                prev_cell = states(index)
                states(index) = 0
            else:
                prev_cell = states(index)
                states(index) = 1
            index += 1
    return states

I used to think of taking advantage of the fact that they are just zeros and ones, and using bitwise operators, but that did not quite work.

Can I improve the efficiency of this algorithm? Any ideas for the "optimal" solution?

Appreciate all feedback, thanks!

Do you need help? Delete specific cells in multiple tabs in Google Sheets Scripts

I am having trouble editing this code to handle multiple sheets at once. It works for anything that is active, but I want to disable that and use it on every tab named after each month, and when I try to use getSheetByName () it does not seem to work. Here is the code that works.

function onOpen() {   
SpreadsheetApp.getUi()  
.createMenu('Reset sheet')  
.addItem('Remove all metrics', 'userActionResetByRangesAddresses')  
.addToUi();
}

function userActionResetByRangesAddresses(){  
var sheet1 = SpreadsheetApp.getActiveSheet();  
var rangesAddressesList = ('D4:E53', 'I4:I53', 'M4:O53','D60:E109', 'I60:I109', 'M60:O109','D116:E165', 'I116:I165', 'M116:O165', 'D172:E221', 'I172:I221', 'M172:O221','D228:E277', 'I228:I277', 'M228:O277');  
resetByRangesList_(sheet1, rangesAddressesList);  
}

function resetByRangesList_(sheet1, rangesAddressesList){   
sheet1.getRangeList(rangesAddressesList).clearContent();  
}  

Any help would be appreciated!

google sheets – setValue in a column if other columns satisfy criteria based on reference cells

I'm new to Google AppScript and would appreciate a help here.

I want to use that setValue along with for loop and if statement in Google App Script to scan multiple columns in Google Sheets and set the value of the data in column F based on the results of other columns using reference cells B2. B3,

So, if values ​​in column D are the same cell B2 and values in column E are the same cell B3change the value of each line in column F agree with this criterion of Pending to Ordered

I have attached a picture with the desired result.

Enter image description here

Plotting – How do I associate 3 points with 2 line segments if the points come from different cells of GraphicsGrid?

I want

  • to connect the 3 red dots
  • to represent the red dots on the sinusoidal circle instead of elliptical.
  • To create these 3 artboards, they are scaled correctly so that the connecting lines are parallel to the horizontal and vertical axes.

Enter image description here

Manipulate[
 GraphicsGrid[{
   {
    Graphics[{
      {Red, Disk[{Cos
      {Dashed, Blue, Line[{{0, 0}, {Cos
      {Dashed, Gray, Circle[{0, 0}, 1]}
      }, PlotRange -> {{-1.2, 1.2}, {-1.2, 1.2}}, Axes -> True, 
     AspectRatio -> 1],
    Show[
     Graphics[{
       {Red, Dashed, Line[{{t, 0}, {t, Sin
       {Red, Dashed, Line[{{0, Sin
       {Red, Disk[{t, Sin
       }],
     Plot[Sin[x], {x, 0, t}]
     , PlotRange -> {{-0, 2 [Pi]}, {-1.2, 1.2}}, Axes -> True, 
     AspectRatio -> 1, AxesLabel -> {"t", "Sin
    }, {
    Rotate[Show[
      Graphics[{
        {Red, Dashed, Line[{{t, 0}, {t, Cos
        {Red, Dashed, Line[{{0, Cos
        {Red, Disk[{t, Cos
        }],
      Plot[Cos[x], {x, 0, t}]
      , PlotRange -> {{-0, 2 [Pi]}, {-1.2, 1.2}}, Axes -> True, 
      AspectRatio -> 1, AxesLabel -> {"t", "Cos
    }
   }],
 {t, 0.001, 2 [Pi]}]

ios – How to fit rounded collection cells to all screens?

That's why I'm usually used to designing square cells for the collection view to fit perfectly on all screens. However, as soon as I start adding spacing and section inserts, I come across this problem.

So I want all the cells to be displayed on every screen.

iphoneX

I have the minimum space for cells and lines at 10.
And for the slots for the right and left sections, they are also set to 10.

Enter image description here

This is the result I get on other devices (iPhone 7 / XsMax)

Enter image description here

Enter image description here

I tried