IF or IFS google sheet array formula - if-statement

My array formula needs to be updated to include another if statement.
The original formula, works great:
=ARRAYFORMULA(IF(((O2:O<TODAY())*(I2:I<>"Delivered"))>0,"🔴 Past due","⚫ On track"))
Translates to: If task due date is less than today and the status is not equal to delivered, then past due, else on track.
I now need the formula to read: If task due date is less than today and the status is not delivered, then "past due" OR if task due date is blank and status is equal to not started, then leave the cell blank.
I am not sure if I should be using IF or IFS.
My attempt at re-writing the formula is below.
=ARRAYFORMULA(IFS(((O2:O<TODAY())(I2:I<>"Delivered"))>0,"🔴 Past due",[(O2:O=""())(I2:I<>"Not Started"))>0,""]))
Basically the task is either past due or the cell should be blank or if this is even possible.
spreadsheet image

IFS is not supported under arrayformula properly. use:
=ARRAYFORMULA(
IF((O2:O<TODAY())*(I2:I<>"Delivered"), "🔴 Past due",
IF((O2:O="")*(I2:I<>"Not Started"), "", )))
update
=ARRAYFORMULA(
IF((O2:O="")*(I2:I="Not Started"), "",
IF((O2:O<TODAY())*(I2:I<>"Delivered"), "🔴 Past due", )))

Related

Google sheets - How to compare a formula within a cell with a string to spot changes in the formula?

I help a small business with an application which is entirely run from google sheets and google forms. The issue is that from time to time the business owner will go into the sheet and delete rows of old data. I've noticed that as a result, some of the formulas will change the row which they are looking at. This is despite me using explicit cell references such as $A$1 for example.
So what I would like to do, is use somehow compare the cell which contains the formula, with a string of what the formula should be, then return a value if the formula matches. I had thought an =If function would solve this but so far I am not having any luck.
This is what I have used so far:
Lets say cell A1 contains the formula I want to check and the formula is (this works fine): =FILTER(Dashboard!A2:A, Dashboard!C2:C1 = TODAY())*
I am using =IF(A1="=FILTER(Dashboard!A2:A, Dashboard!C2:C*1 = TODAY())",True,False)
I am expecting the function to compare the value of A1 with my string and return the value True. If the formula does not match the string it should return the value False.
I currently am returning the value of False despite the formula and string being an exact match. I assume this is because my =If statement is looking at the value returned by the =Filter function rather than the formula itself.
Any help would be appreciated.
thanks
You could just use INDIRECT() in the place of explicit cell ($A$1) reference you mentioned and that should solve the problem of formulas going haywire due to rows deletion in Form Responses tab. Please do test it out.
INDIRECT("Sheet!"&A1)
INDIRECT("A1")

Is there a way to check the value of the cell to the left and add two to the count, unless there is a value entered in another cell in the same row?

I am trying to write a piece of code in Google Sheets that automatically creates a follow-up date based on the date in the immediate left cell. It gets that date, and adds two (days) to it. Then that date gets pushed into Appsheet, where it is marked on a virtual calendar.
I also want the code to recognize when something is filled into the "Status" section (which is located in the 4th cell to the right) and fill in the current cell with something like "Done".
Currently, everything I have works except for that last part, when something is entered into the Status column I get an error that reads;
Function IF parameter 1 expects boolean values. But 'Declined' is a
text and cannot be coerced to a boolean.
I believe that means I need to convert the data in the status column into a boolean value, but I have no idea how to proceed in doing that. See below code;
=IF(INDIRECT("RC[4]",0), "Done", INDIRECT("RC[-1]",0) +2)
Let me know what you guys think, and thank you in advance for your help 👍
try:
=IF(INDIRECT("RC[4]",0)="Declined", "Done", INDIRECT("RC[-1]",0) +2)
or:
=IF(INDIRECT("RC[4]",0)<>"Declined", "Done", INDIRECT("RC[-1]",0) +2)

Google Sheets: Sum a Value Range Within a Specified Time Frame

I'm trying to sum a range of values, within a given time frame. The time frame could be x hours, or y days, etc. An example:
So for each row, I need to sum the last hours or days as specified in cells C2:E2, which are numeric (just added formatting to show the text). Note that the datetime values do not follow any interval pattern, but are always sequential.
Although I've tried searching SO, and via Google, I haven't been able to find a way to do this.
Any suggestions would be very welcome.
[Edit]
I've added to a link to an example sheet of what I'm trying to do... pls just ask if I can add any further info!
Test Sum By Time
try:
=SUMIFS(B3:B, A3:A, ">="&NOW()-1)
=SUMIFS(B3:B, A3:A, ">="&NOW()-7)
In Google sheets, use the =TODAY() code to for today's date and put this in another cell. You could always create a new sheet (which we will call sheet3) which you hide afterwards. Let's imagine you put this in cell A1.
You can use the =IMPORTRANGE("the google sheets website link", "Sheet Name!A3:A31" to insert the values. Let's imagine you import this into B3:B31. In C3, you put =IF(REGEXMATCH(B3, A1), 1, 0).
You continue this in each cell from B4:B31, each time changing "B3" to the current row number. Then we can use the =SUM(C3:C31) code to count how many meet this condition. Let's imagine you put this in A2.
Now back to the original sheet. Use `=IMPORTRANGE("the google sheets website link", "sheet3!A2" in the cell C3.
For the other 2, I don't know, sorry!

Parse Days in Status field from Jira Cloud for Google Sheets

I am using Jira Cloud for Sheets Adds on in order to get Days in Status field from Jira, it seems to have the following syntax, from this post
<STATUS_ID>_*:*_<NUMBER_OF_TIMES_ISSUE_WAS_IN_THIS_STATUS>_*:*_<SECONDS>_*|
Here is an example:
10060_*:*_1_*:*_1121033406_*|*_3_*:*_1_*:*_7409_*|*_10000_*:*_1_*:*_270003163_*|*_10088_*:*_1_*:*_2595005_*|*_10087_*:*_1_*:*_1126144_*|*_10001_*:*_1_*:*_0
I am trying to extract for example how many times the issue was In QA status and the duration on a given status. I am dealing with parsing this pattern for obtaining this information and return it using an ARRAYFORMULA. Days in Status field information will be provided only when the issue was completed (is in Done status), otherwise, no information will be provided. if the issue is in Done status, but it didn't transition for a given status, this information will not be provided in the Days in Status string.
I am trying to use REGEXEXTRACT function to match a pattern for example:
=REGEXEXTRACT(C2, "(10060)_\*:\*_\d+_\*:\*_\d+_\*|")
and it returns an empty value, where I expect 10068. I brought my attention that when I use REGEXMATCH function it returns TRUE:
=REGEXMATCH(C2, "(10060)_\*:\*_\d+_\*:\*_\d+_\*|")
so the syntax is not clear. Google refers as a reference for Regular Expression to the following documentation. It seems to be an issue with the vertical bar |, per this documentation it is a special character that should be represented like this \v, but this doesn't work. The REGEXMATCH returns FALSE. I am trying to use some online RegEx tester, that implements Google Sheets syntax (RE2), I found ReGo, that I don't know if it is a valid one.
I was trying to use SPLITfunction like this:
=query(SPLIT(C2, "_*:*_"), "SELECT Col1")
but it seems to be a more complicated approach for getting all the values I need from Days in Status field string, but it separates well all the values from the previous pattern. In this case, I am getting the first Status ID. The number of columns returned by SPLITwill varies because it depends on the number of statuses the issues transitioned in order to get to DONE status.
It seems to be a complex task given all the issues I have encounter, but maybe some of you were dealing with this before and may advise about some ideas. It requires properly parsing the information and then extracting the information on specific columns using ARRAYFORMULA function when it applies for a given status from Status column.
Here is a google spreadsheet sample with the input information. I would like to populate the information for the following columns for Times In QA (C column) and Duration in QA (D column, the information is provided in seconds I would need in days but this is a minor task) for In QA status, then the same would apply for the rest of the other statuses. I added the tab Settings for mapping the Status ID to my Status, I would need to use a lookup function for matching the Status column in the Jira Issues tab. I would like to have a solution, without adding helper columns maybe it will require some script.
https://docs.google.com/spreadsheets/d/1ys6oiel1aJkQR9nfxWJsmEyd7XiNkVB-omcNL0ohckY/edit?usp=sharing
try:
=INDEX(IFERROR(1/(1/QUERY(1*IFNA(REGEXEXTRACT(C2:C, "10087.{5}(\d+).{5}(\d+)")),
"select Col1,Col2/86400 label Col2/86400''"))))
...so after we do REGEXEXTRACT some rows (which cannot be extracted from) will output as #N/A error so we wrap it into IFNA to remove those errors. then we multiply it by *1 to convert everything into numeric numbers (regex works & outputs always only plain text format). then we use QUERY to convert 2nd column into proper seconds in one go. at this point every row has some value so to get rid of zeros for rows we don't need (like row 2,3,5,8,9,etc) and keep the output numeric, we use IFERROR(1/(1/ wrapping. and finally, we use INDEX or ARRAYFORMULA to process our array.

Not getting expected results in IF statement, when referencing another cell also with an IF statement

Issue, I'm looking for a result in one cell based on results on another cell where both cells are using IF statements. The expected result is not displayed.
Example
Cell N14 is using a SUMIF formula to add the number of hours a person worked.
In this issue, the result is zero (0).
The result of the SUMIF on false is "", showing the cell blank
Formula
=SUMIFS([Column_Hours_Worked],[Column_Name],[Name],[Column_Date],[Date],"","")
The formula I know works, as seen in cell N13.
Cell O14 uses an IF statement, and returns an "X" if N14 is less than eight (8))
=IF(N14>=8,"","X")
The N14 cell seems to work fine, as I observe the cell is blank.
- This is expected.
The O14 cell is not displaying the expected "X".
Troubleshooting
I can manually enter zero (0) into N14, which causes the expected "X" in O14.
I modified the SUMIF false result from blank ("") to ("0.0"), and did not see the expected "X" in O14.
O.O was observed in the N14 cell, as the SUMIF resulted in a false statement, or ("0.0")
Background
I've created a spreadsheet to track the number of hours people work on a given day.
I'd like to quickly identify when, in this example, less than 8 hours is worked.
N14 = The number of hours worked.
O14 = A flag ("X") at less than 8 hours.
Any suggestions?
I recreated a spreadsheet with your formulas and some basic data. When I removed the last two arguments from your N14 formula it worked for me (see below).
=SUMIFS([Column_Hours_Worked],[Column_Name],[Name],[Column_Date],[Date])
Is there a specific reason you'd like the SUMIFS to return "" instead of 0? In fact, I can't get SUMIFS to work with those last two arguments. You mentioned you a sumif on false argument but I don't believe the sumif function has an input for 'if false return this'. If you want that you'll have to nest SUMIFS inside an IF formula (like below) and then you can combine the N14 and O14 formulas.
=IF(SUMIFS([Column_Hours_Worked],[Column_Name],[Name],[Column_Date],[Date]<=8,"X","")