Inferior Bar not Summing properly on ArrayFormulas - google-sheets

I had the sheet working perfectly without any problem. And one moment without making anything to my formulas, the sum of hours and minutes in the inferior bar stopped summing as an hour but in decimals. I give you this example:
If I click 2 cells with formatted as hour (A1 = 00:01:00 + A2 = 00:02:00) it should appear on the inferior bar the result of 00:03:00, but now it appears as decimals number (0,005).
This only happens on my array formulas, for example:
=ArrayFormula(D94/IFERROR(INDEX(Art!Q$4:Q$500;MATCH(1;($G94=Art!$D$4:$D$500)*($F94=Art!$C$4:$C$500)*($H94=Art!$E$4:$E$500)*(COUNTIF($A$45:$A94;Art!$D$4:$D$500)=0);0));""))/24
In the past was working perfectly. Nothing has changed in the overall sheet.
I think that the devs must have changed something on the google sheets that is making this bug now.
Anyone knows how to fix this or to go around this problem?
First image has arrayformula, second dont.

Related

How can I set a cell to highlight after X hours have passed in Google Sheets

I have a Google Sheet where a column is filled with times in a 24 hour format (XX:xx), how can I select a cell to highlight red after 3 hours have passed with conditional formatting?
I've been trying to mess with the Now() command in custom formulas for like 2 hours now, but I can't seem to get it to work. PLZ HELP!
To Highlight cells if exactly 3 hours 03:00:00.000 have been passed you need to paste this formula in format>conditional formating. > format cell if - Custom Formula, take a look at the example in this sheet.
=ArrayFormula(IF(A3:A="",,IF(A3:A-NOW()>0.13,"True","False") ))
A3:A-NOW()>0.13 to check if the date in the range A3:A minus NOW() is greater than 0.13 which represent an hour 03:00:00.000 as a number.
To check and highlight cells when certain duration have been passed and be able to adjust the duration from a cell you need to paste this formula in cell B2 to get True or False output.
=ArrayFormula(IF(A2:A="",,IF(A2:A-NOW()>$E$2,"True","False")))
It can be used as a formula in format>conditional formating.
take a look at the example in this sheet.
the columns highlighted in blue is for demonstration it can be deleted.
For anyone who has the same issue, it has been solved. Looks like the Now() call requires both the time and date to be inside the cell in order to work.
The formula I used to highlight cells that are older than 3 hours is
=(Now()-TIME(3,0,0))
A friend also showed me a different formula that seems to do the same thing
=IF(NOW()>A2+3/24,TRUE(),FALSE())
You can change the time by changing the (3,0,0) to Hrs,Min,Sec of your choosing, for the second formula, you can change it by adjusting the fraction value (3/24 for 3 hours, etc)
These will only work if you have the date and time in the cells you are formatting (e.g. If you timestamp with Ctrl+Alt+Shift+;) it will not work if you timestamp with just the time (Ctrl+Alt+Shift) as that seems to set the year to 1899 for some reason.
It would be nice if I could get these working without a date, but I have not found a way to do that.

How do I set conditional formatting based on data in two different cells?

I have a Google Sheet and I want to set a fill color in one cell based on a date and a text value in two different cells. Essentially, A1 should be red if B1 date is older than 15 days ago AND C1 reads "These are words" I have tried multiple things but I cannot seem to find any formulas that work. I have listed below what formulas I have tried along with what effect they had. Any help would be appreciated.
Additionally, I apologize if this has been answered somewhere, I looked but could not find anything.
Only highlights date that is EXACTLY 15 days ago
=AND($B:$B=TODAY()-15,$C:$C="These Are Words")
Does not Highlight anything
=AND(=ISBETWEEN($B:$B=TODAY()-15,=TODAY(),$C:$C="These Are Word")
I have also tried setting specific cells (i.e. B1 instead of $B:$B)
Example of desired effect
Instead of the = operator use the <= operator:
=AND($B:$B<=(TODAY()-15),$C:$C="These Are Words")

Trying to subtract a value from the TODAY() function is generating the wrong result

[Share link to a copy of the spreadsheet][1]
[1]: https://docs.google.com/spreadsheets/d/1OFwScEx93z4siZMOQoJB9dtAF1dFEZcnyyj6V1CqF6U/edit?usp=sharing
I think the problem lies within the formatting but I don't know how to get past it. I've been working on it for several hours trying various formattings changing to text versions of a date, and using TO_DATE and more but not working. I'm stumped.
The equation in N7 worked great in 2020 but broke in 2021
"My Question: I'm trying to determine if the value in M7 is less than 7 days from =TODAY() in cell N7.
The equation is in cell N7.
How can I rework this so it works again?"
This question is only for the value in M7 and the equation in N7. I believe if we can figure it out I can copy to the other cells.
When I click on cell M7 it is showing me the wrong year in the formula bar.
Instead of 2020-01-08 is shows 2021-01-08 but you can clearly see is displays 2020-01-08.
This is where the problem is (I think) but I don't know how to get past it.
To the right of the table in row 6 are equations and the values they return. None of the values work when trying to subtract from the TODAY() function. I've also tried using the NOW() function. I'm open to try other ideas.
I could subtract 366 in the equation and the true would go away but that only works if the row is true. Meaning I would have to change it every time there was a false-positive throughout the year.
I suspect the answer lies in the formatting of column M since I am subtracting that value from TODAY().
Any ideas?
Thanks,
Rick
there is a wrong custom formatting for that cell with forced/static year:
where it should be:

Not calculating correct number or refreshing

I am using Google Sheets and have just noticed a very worrying issue.
I have a situation where I have a number (for example 4.99) in the left column and the right column through a series of formulae may come out as 30% or so. I changed the number in the left to 5 and the number is the right column jumped to 50% or so (highly unexpected to see such a large jump for such a small increase, so I decided to investigate). When I typed 4.99 back into the left box, the result in the right was just slightly lower than the 50% or so.
I then checked several other numbers in the left column. It turns out that this was the same for all of them. I.e. the number in the right column was not calculating properly until I changed the number in the left column and pressed enter. How is this possible? I have never had this problem with Excel and I don't know what to do other than to migrate back to Excel as I am now doubting the reliability of all the spreadsheets I have on Google Sheets.
Has anybody else come across this problem?
I managed to figure it out moments after posting this.
In the column for some reason some of the cells were considered numbers and some text. I performed an if statement (<10), which came out FALSE for all cells considered text.
Quite dangerous - surely the cell on the right should show an error and not assume FALSE?

How to average the last seven values in a column?

I am trying to find the average of the seven most recent entries in a row, as seen in
this
spreadsheet.
I found a few questions similar to mine, but I am still pretty confused on how the answers work. The questions similar to mine can be found on the left side of my spreadsheet.
I think that the formulas would work for me with a few simple adjustments of which values to use, but I can't seem to figure it out. I would really appreciate if someone could explain one of the existing answers or come up with another one that works.
The spreadsheet is updated daily, so I need something that would continue to work as more and more data is added to the column.
Try:
=round(AVERAGE(OFFSET(H1,MAX(ARRAYFORMULA(ROW(H:H)*--(H:H<>"")))-7,,7)))
here's working sample
Explanation
We are getting the last non empty row: MAX(ARRAYFORMULA(ROW(H:H)*--(H:H<>"")))
Then with offset formula we are getting the range of last 7 cells in a column.
And then just use AVERAGE.
More info
You may find more info about finding the last non empty row here:
Selecting the last value of a column
Another way is to use INDEX and MATCH. The first match finds the position of the last number in the range and takes 6 away from it: the second match finds the position of the last number in the range. Passing it through the INDEX function gives a reference that you can use to give a range of 7 cells for AVERAGE to work on.
=average(index(H:H,match(999,H:H)-6):index(H:H,match(999,H:H)))
So my answer is like your Link2
The big snag here is if you have a text cell in the range (like "Nothing") it is much more difficult to work out which cell to start from to get an average of 7 cells. I think I know how to do it in Excel using OFFSET but offset doesn't seem to work in the same way in Google Sheets.
However I can see there is a solution to this in your Link3 which should work for you if you change A:A to H:H and SUM to AVERAGE. I have tested it on the average of the last ten cells which includes a "Nothing" cell:
=ArrayFormula(AVERAGE(QUERY(SORT(H:H,ROW(H:H)*ISNUMBER(H:H),0),"select * limit 10")))
and it gives the correct answer 61.8.
The way array formulas work in general is that instead of passing a single value to a function you pass a whole range or array (a list of values) and the function processes them one by one. The above formula takes the whole column H:H and sorts it on the row numbers in descending order but those cells which don't contain a number give zero in the multiplication and are sorted to the bottom. Then the query takes the top (in my case) 10 cells and passes them to AVERAGE.
BTW this doesn't have to be declared as an array formula: this also works
=AVERAGE(QUERY(SORT(H:H,ROW(H:H)*ISNUMBER(H:H),0),"select * limit 10"))

Resources