Nesting IF statements 2 - google-sheets

This is my basic IF statement. I need to preface this statement so that if the referenced cell is blank it returns a blank field instead of a 0.
=IF( (G19) < 9 , 0 , 100 )

Try below formula -
=IF(ISBLANK(G19),"", IF(G19 < 9 , 0 , 100 ))

Related

Fill missing dates in Google Sheets

I have two columns:
Col A Col B
01.02.2020 17
03.11.2020 24
03.11.2020 12
As I stated in another question, I tried to sum Col B, based on the month in Col A. The solution was the following formula (without the sort):
=ARRAYFORMULA(
SUMIF(
MID(A:A, 4, 2),
SORT(UNIQUE(MID(FILTER(A3:A, A3:A <> ""), 4, 2))),
B:B
)
)
Something I missed was the population of missing months. Therefore my question is: How can I populate the result table with the missing months and zeroes until values are entered? The desired output for the table above would be:e
Col A Col B Col C
01.02.2020 17 0
03.11.2020 24 17
14.12.2020 100 0
03.11.2020 12 0
0
0
0
0
0
0
36
100
If just doing it for the current year, this should be enough
=ArrayFormula(sumif(mid(A2:A,4,2),sequence(12),B2:B))
alternative:
=ARRAYFORMULA(IFNA(VLOOKUP(ROW(A1:A12), QUERY(A:B,
"select month(A),sum(B) group by month(A)"), 2, 0), 0))

How to count 2 columns with a range

A B C
Val 1 2
Val 2 1
Val 3 1
Item 1 Val 1 1
Item 2 Val 2 1
Item 3 Val 3 0
Item 4 Val 1 0
Consider the above sheet. In the first 3 rows I am counting how many times corresponding val# shows up in the sheet. I have done that with: =COUNTIF($B$5:$B, A1) However, I can't figure out how to make it count only if the value matches and column C doesn't have a 1 next to it on same row. Is this possible?
try COUNTIFS:
=COUNTIFS(B$5:B, A1, C$5:C, "<>"&1)
make sure C column is formatted as Number

Sum up numbers and text numbers per row in a range

I have the following sheet.
H I J K ... BD
2,3 4 2,4,7 ... 1
3,7 10 ... 8,13
The cell ‘H’ has 2,3 as text but cell ’I’ has the number 4, cell ‘J’ has the 2,4,7 as text and cell ‘BD’ has 1 as a number. All the cells that have 2 or more numbers as text are separated by commas
I want to sum all numbers and non-numbers to one single row using array-formula.
The result must be
BE
16
41
The range is between H2:BD with H1:BD1 for the headers
I have used this code:
=arrayformula(if(row(A1:A)=1;"BottleQty";if(len(A1:A)>0;
SUBSTITUTE(transpose(query(transpose(H1:BD);;COLUMNS(H2:BD)));",";"");iferror(1/0))))
but the result is
BE
2 3 4 2 4 7 1
3 7 10 8 13
Any help ??
Thanks in advance
=ARRAYFORMULA(IF(LEN(TRIM(TRANSPOSE(QUERY(TRANSPOSE(A2:D),,99^99)))),
MMULT(IFERROR(SPLIT(TRANSPOSE(QUERY(TRANSPOSE(A2:D),,99^99)), ", ")*1, 0), ROW(INDIRECT("A1:A"&
COLUMNS(IFERROR(SPLIT(TRANSPOSE(QUERY(TRANSPOSE(A2:D),,99^99)), ", ")*1, 0))))^0), ))

Selecting a specific row with a condition ? LibreOffice Calc

I have this LibreOffice calc file with raws with full of zero
raw1 raw2 raw3 raw4 raw5 raw6 raw7 raw8 raw9
0 0 0 0 C 0 0 0 0
0 0 0 0 0 0 0 W 0
I want to print only the character inside the row, like this
Result
C
W
I did try with 'if' condition
IF(CD2:CR16 = 1, CD2:CR16)
but it's give me an error
Use MATCH to find the column that contains a character, and then INDEX to get the cell's value.
=INDEX(CD2:CR2, MATCH("[A-Z]", CD2:CR2, 0))
For this to work, go to Tools -> Options -> LibreOffice Calc -> Calculate, and choose Enable regular expressions in formulas.
EDIT:
According to https://help.libreoffice.org/Common/List_of_Regular_Expressions, [:print:] represents any printable character, so it grabs the first zero, which is probably why it does not seem to do what you want.
To match one of several words, the regular expression should be like this:
"word1|word2|word3"
Or for any word consisting of one or more letters:
"[:alpha:]+"
EDIT 2:
To grab C and 8 from 0 0 C 0 and 8 0 0 0 respectively, use "[A-Z1-9]".

Google Spreadsheet, operations with above row cell in same column with arrayformula

I have arrayformula in the first row of a column so my values and calculations can start in Row 2 and for all the column length.
I have this situation:
https://docs.google.com/spreadsheets/d/11oDra7Vja4-5C0Uix7JTgLLSMG3gPj-6fkajXlWqqQk/edit?usp=sharing
I need a simply arithmetic operation:
Subtract above value of the same column for every row.
I'm using:
=arrayformula(IF(row(A:A)=1; "What I have now"; IF(ISBLANK(A:A); ""; A1:A-A2:A)))
but as you see is wrong.
How to do that?
UPDATED QUESTION:
And then in the second sheet I need a SUM operation with some blank cells in column:
How to do that?
https://docs.google.com/spreadsheets/d/11oDra7Vja4-5C0Uix7JTgLLSMG3gPj-6fkajXlWqqQk/edit#gid=931743679
If you want to have the array formula ion the header this is a bit weird as you need to allow the formula to technically access row 0, we can do this by constructing ranges.
=ArrayFormula(IF(
--(ROW(A1:A) > 2) + -ISBLANK(A1:A) = 1;
{0; A1:A} - {0; A2:A; 0};
""))
--(ROW(A1:A) > 2) + -ISBLANK(A1:A) = 1 Checks if the row is populated and not one of the first two rows in a way that works nicely with array formulas
{0; A1:A} - {0; A2:A; 0} does the following:
0 Data 156 123 110 95 42
- - - - - - -
0 156 123 110 95 42 0
= = = = = = =
0 33 13 15 53 42 42
N N Y Y Y Y N <- Is shown
^ ^ ^
| | Because Row is blank
| |
Because row not > 2, thus it is never evalauated even though the second would cause an error
I think this is quite tricky. The problem is that in an array formula the number of cells in each array must match - you can't mix an array starting in row 1 with an array starting in row 2 if they go all the way to the bottom of the spreadsheet.
Here is one way of getting the result you want
=arrayformula({"What I need";"";offset($A$1,1,0,count(A:A)-1)-offset($A$1,2,0,count(A:A)-1)})
You will need to change the ; and , for your locale.
I have built up an array using the {} notation to define the elements. In my locale a ; means go to the next row, so I have defined the first two cells directly as strings. After that I've chosen to use Offset to get the range A2:A5 (1 row down from A1, 0 rows across and 4 cells high) and subtract the range A3:A6 (2 rows down from A1, 0 rows across and 4 cells high) it so that gives me the other 4 cells.
B1 "What I need"
B2 ""
B3 A3-A2=33
B4 A4-A3=13
B5 A5-A4=15
B6 A6-A5=53
but will need an IF statement adding if there are any blank cells between the numbers.
In the particular case of your updated question where there are fewer numbers in column D than column C, the formula would be
=arrayformula({"Special Case";"";offset($D$1,1,0,count(D:D))+offset($C$1,2,0,count(D:D))})
But in the general case of there being blank cells anywhere, you would have to test everything
=arrayformula({"General Case";"";if(offset($D$1,1,0,rows(C:C)-2)="","",if(offset($C$1,2,0,Rows(C:C)-2)="","",offset($D$1,1,0,rows(C:C)-2)+offset($C$1,2,0,Rows(C:C)-2)))})

Resources