Imagine you have the following table, see down below. Now, I would like to tell LibreOffice to create out of all three columns a series with custom intervals each. Is this possible?
The series shall be like this:
Increase number by 1 every 112 rows and insert current number inbetween.
Increase number by 1 every 28 rows and insert current number inbetween.
Increase number by 1 every 7 rows and insert current number inbetween.
You can use formula =INT((ROW()-1)/period)+startingNumber and drag it down (with black square at the bottom right of selected cell) to copy it to number of rows.
Or you can use simple macro (where period equals 7, 28 or 112):
Option Explicit
Sub Main
Dim numberOfRows, n, period, startingNumber As Integer
Dim destinationCell As Variant
period = 7
numberOfRows = 30
startingNumber = 1
For n = 0 To numberOfRows-1
destinationCell=ThisComponent.Sheets.getByIndex(0).getCellByPosition(0,n)
destinationCell.setValue(Int(n/period)+startingNumber)
Next n
End Sub
Related
I have a sheet that has blocks of cells. I add them for a total if they don't contain any letter. Letters signify a specific variable or signifier code for tracking. I also want to add the cell value when a cell has an ending code letter. I've tried SUMIF, Substitute, SumProduct and a few others.
For a while I've used the following which worked till the S value changed to another number than "8" which then gave the wrong sum from the range.
=if(countif(D64:Q64,"*S")=0,"",((countif(D64:Q64,"*S"))*8))
In the cell range I have 5 variable groups ending in a letter (A, H, S, C and R) and one group not ending in any letter.
The formula I use to add the cells not containing a letter but have a value is this
=IF(SUM(AA64,(SUMIF(D65:Q65,"<>")),-(COUNTIF(D65:Q65,">=0")*8))>24,24,(SUM(AA64,(SUMIF(D65:Q65,"<>")),-(COUNTIF(D65:Q65,">=0")*8))))
which adds the table data plus the previous lines table data but does not exceed 24.
H is a set value of 6 and doesn't change.
Does anyone know how to add the value of the cells that contain a specific letter?
N (number)
A
S
C
R
H
8.5
H
8A
2S
9
3C
0.5R
17.5
8
2
3
0.5
6
I'd prefer it be a formula usable in Google Sheets because that is where this data is.
Solution:
You can use this formula below column "N" then drag right until below column "H".
=SWITCH(H$1,"N",SUM($A2:$G2),"H",6,SUM(IFERROR(ARRAYFORMULA(VALUE(LEFT($A2:$G2,FIND(H$1,$A2:$G2)-1))),0)))
This is a combination of three formulas:
If the row above is N, sum A2 to G2. This will ignore all the strings.
If the row above is H, output 6.
Else, get the number to the left of the defined suffix, set all others to 0, and get the sum.
Output:
References:
Extract number from string in Google Sheets
An alternative could be to use
=SUMPRODUCT(A3:G3, isnumber(A3:G3))
to compute the sum of the cells with numbers only, and to use
=sum(filter(substitute($A$3:$G$3, I$2,)+0, regexmatch($A$3:$G$3, I$2)))
under the 'A' and drag to the right
Examples
I am new to google sheets and am unaware of how to create a sequence of numbers in a column. I want to create a column with numbers from 0 to 1000 in increments of 10
Method 1 (formula)
Copy the following formula =(ROW()-1)*10
Select cells A1:A100
Paste the formula.
Method 2 (fill down series):
Write 0 on A1
Write 10 on A2
Write 20 on A3
Select A1:A3
Click on the bottom right corner of A3, then drag down until A100.
=ARRAYFORMULA({0; ROW(A1:A100)&0})
or:
=ARRAYFORMULA({0\ ROW(A1:A100)&0})
if you want real numbers then use:
=ARRAYFORMULA({0; VALUE(ROW(A1:A100)&0)})
or:
=ARRAYFORMULA({0\ VALUE(ROW(A1:A100)&0)})
I have a number that represents a starting point. What I need to do is to create different "Levels"(using formulas) based on that number and display those in a single cell
Example:
Max Speed 60 Mph
Level 1 10-15
Level 2 16-21
....
Level 7 55-60
You can try this. In B2 put 60. Then in B4 put:
=int(B2*10/60)&"-"&int(B2*15/60)
In B5 put:
=int(B2*16/60)&"-"&int(B2*21/60)
And so on for the different levels.
I have a spreadsheet where I need to conditional format/highlight the lowest 3 scores in a row to reflect dropped scores that are part of a Total calculation. I'm using the SMALL function to successfully calculate the Total..=SUM(A2:I2)-SMALL(A2:I2,1)-SMALL(A2:I2,2)-SMALL(A2:I2,3) but when I try to use the SMALL function in the Custom Formula field of the Conditional Format it highlights 0,60,60,60 and not 0,60,60
119 101 60 100 0 109 60 60 112 TOTAL:601
If four of the values are 0, it will highlight all for 0's.. if 60 is the lowest score and there are 4 or more scores of 60, it will highlight all and not reflect that only 3 of the scores are actually dropped.
Is there another way (custom formula) that can only highlight the lowest 3 scores in the row even when the 3rd lowest may have duplicates in the row?
I've come up with this formula (assuming values start in A1) which unfortunately is a bit long
=OR(A1<SMALL($A1:$I1,3),AND(A1=SMALL($A1:$I1,3),COUNTIF($A1:A1,SMALL($A1:$I1,3))<=(3-COUNTIF($A1:$I1,"<"&SMALL($A1:$I1,3)))))
or
=OR(A1<SMALL($A1:$I1,3),AND(A1=SMALL($A1:$I1,3),(COUNTIF($A1:A1,SMALL($A1:$I1,3))+COUNTIF($A1:$I1,"<"&SMALL($A1:$I1,3))<=3)))
The logic is that it highlights all cells which are less than the third smallest value, then any values (starting from the left) which are equal to the third smallest value until the total equals three.
I've changed the second row to show that it selects the second zero instead of the second 60.
I'm perfectly aware of the sumif() Function in Google Sheets.
A B
1 15
2 20
2 10
3 30
5 45
1 10
When I want to calculate the sum of all values in the array smaller then 3, I can use SUMIF(A:A;"<3";B:B) .
When looking for all values equal to another cell value (C1), I can use
=SUMIF(A:A;C1;B:B).
But I can't find a way to calculate the sum for all values for all cell values smaller then the cell value in C1 SUMIF(A:A;<C1,B:B) doesn't work. What do I do wrong?
To sum all values in B:B that correspond with values in A:A that are smaller than a value housed in C1:
=SUMIF(A:A;"<"&C1;B:B)