Assistance with returning value based on cell being populated with number - openoffice.org

Hello and thank you for looking at my post. I am a super noob at spreadsheets but need to automate part of a cost spreadsheet in open office calc after my assistant has repeatedly managed to forget to enter the right data. Here we go:
PART 1
Output is in cell D1.
I have a column of cells A1 to A10, if there is a number (any number) in one or more cells from A1 to A3 then I need the D1 to equal cell B1
+ 1.
If there is also a number in A4 to A6 then this supercedes the previous formula and D1 will now be B1 + 2.
Lastly if there is a number in A7 to A10 then again all previous code is superceded and D1 is now B1 + 3.
PART 2
I have cells C1 to C3. If D1 equals B1 + 1, C1 will equal D1 if greater than 3, else it will be 3. C2 and C3 must be 0 or empty.
If D1 equals B1 + 2, C2 will equal D1 if greater than 4, else it will be 4. C1 and C3 must also be 0 or empty.
If D1 equals B1 + 3, C3 will equal D1 if greater than 5, else it will be 5. C1 and C2 must also be 0 or empty.
To me this seems almost impossible, I've spent all day trying to learn IF and ELSE statements and ISNUMBER and many other approaches and I've run out of options. Any help or advice would be greatly appreciated and if I haven't been clear please ask me to clarify any point.

Find a column where you can put some other formulas, for example column E. Breaking the formula into parts will make it easier.
In E1, put =IF(E4, 3, IF(E3, 2, IF(E2, 1, 0))).
In E2, put =OR(ISNUMBER(A1),ISNUMBER(A2), ISNUMBER(A3)).
In E3, put =OR(ISNUMBER(A4),ISNUMBER(A5), ISNUMBER(A6)).
In E4, put =OR(ISNUMBER(A7),ISNUMBER(A8), ISNUMBER(A9), ISNUMBER(A10)).
Then the formula for D1 will be simply =B1 + E1. This is part 1 in the question.
For part 2, the requirement of "C2 and C3 must be 0 or empty" should not be needed, because they will be empty if D1 equals B1 + 1 anyway. So this is all that is needed:
In C1, put =IF(E1=1, IF(D1>3, D1, 3), "").
In C2, put =IF(E1=2, IF(D1>4, D1, 4), "").
In C3, put =IF(E1=3, IF(D1>5, D1, 5), "").

Related

Is there a Google Sheets function for 2 or more repeating text in a row, based on text from another cell?

Bassically, Lets say we have Row A, B and C
Row A is name; Row B is a ID, Row C is another ID. I have a function where if Row B repeats twice, the cell becomes red.
Lets take some examples:
Lets say in A1 we have "Joe"
In B1 we have his ID - 1234
In C1 we have his 2nd ID - 7a1d
In A2 we have "Jack"
In B2 we have his ID - 9876
In C2 we have his 2nd ID - 7a1d
Because B1 and B2 are different, but C1 and C2 are the same, both cells are RED
Now lets say we John changed his name to Thomas, so we will have:
A1 - "Joe"
B1 - 1234
C1 - 7a1d
A2 - "Thomas"
B2 - 1234
B2 - 7a1d
Because in this case, B1 and B2 are the same, C1 and C2 will show BLUE, to indicate that he changed his name
I achieved the first part, I just need help with the 2nd one. I need to formula to be in Conditional Formatting.
Something like this?
=AND(B1=B2,C1=C2)
You can anchor columns or rows if you need to do it extensive to other rangea

Google Sheets: Perform a running formula in the same column

I have a simple formula I want to perform in the same column.
Link to sheet
Column A: dates
Column C: multiplier
Column B: where I want to perform the formula.
B2 = B1-B1*$C$1
B3 = B2-B2*$C$1 etc
I'd like to automatically run the formula as the number of months (in Col A) changes.
​A
B
C
1/4/22
100
0.5
1/5/22
50
1/6/22
25
try:
=ARRAYFORMULA(IF(A2:A="",,B1*C1^SEQUENCE(COUNTA(A2:A))))
=arrayformula( B1 * (1 - C1) ^ sequence(count(A2:A)) )

Sort alphanumeric data in natural order in google sheets

I have a list of data I wish to sort in natural order, however it sorts in lexographical order. How can I sort in a natural order?
The data I have, which gets sorted as such:
A1
A10
A11
A12
A13
A14
A2
A3
A4
A5
A6
A7
A8
A9
B1
B2
B3
B4
The order I would like for it to be sorted in:
A1
A2
A3
A4
A5
A6
A7
A8
A9
A10
A11
A12
A13
A14
B1
B2
B3
B4
Suppose the original data as listed in your post resides in range A2:A19. Place the following formula in B2 of an otherwise open range B2:B (or in the Row-2 cell of any other open column where you want the sorted results):
=SORT(A2:A19,REGEXEXTRACT(A2:A19,"\D+"),1,TEXT(REGEXEXTRACT(A2:A19,"\d+")*1,"000"),1)
This formula assumes that the numeric portion of your strings is never longer than three digits. If it does exceed, just change 000 to include the number of zeros that match the max digits that may appear in the numeric portion of your strings.
Of course, you'll need to adjust the A2:A19 to match the actual range of the original data in your sheet.

Combine multiple sheets with same amount of columns but different amount of rows

Given two sheets that look like this:
Sheet1
a1 b1
a1 b1
Sheet2
a2 b2
a2 b2
a2 b2
How could I query for both sheets and combine all the rows together to get something line
Combined
a1 b1
a1 b1
a2 b2
a2 b2
a2 b2
I have tried the following but none of them worked
={QUERY({'Sheet1'!A1:B},"select *");QUERY({'Sheet2'!A1:B},"select *")}
=QUERY({'Sheet1'!A1:B;'Sheet2'!A1:B},"select *")
The problem with both is that I don't specify what row to end at for the two sheets. If I changed it to =QUERY({'Sheet1'!A1:B2;'Sheet2'!A1:B3},"select *"), then it would work. The problem with this is that in my actual spreadsheet, the number of rows in the sheets is changing as I am inputting more data and I would rather not have to update the query everytime.
You were close. Include the full possible ranges and add a bit to the "Select" clause:
=QUERY({Sheet1!A:B;Sheet2!A:B},"Select * Where Col1 Is Not Null")
This returns only the non-null (i.e., existing) data from each sheet.

Google Sheets formula to calculate total sum of values in from multiple columns in another sheet

I need a formula for cell B2 in Sheet1 which will calculate the total value of column B in Sheet2 where the value of column A in Sheet2 matches any URL's in columns C to E in Sheet1.
For example B2 in Sheet1 would total 43 (32 + 9 + 2 from B2 + B4 + B6 in Sheet2), B3 would total 4, B5 would total 4 etc etc.
Note: Sheet1 may sometimes have URL's in
Sheet1
Sheet2
paste in Sheet1!B2 and drag down:
=SUM(ARRAYFORMULA(IFERROR(VLOOKUP(TRANSPOSE(C2:2), Sheet2!A$2:B, 2, 0))))

Resources