I am wanting to establish a conditional format based on a checkbox and the difference in time. Column A is "Test", Column B is "Start Time", and Column C is "End Time." If Column A's box is checked (patient got tested), then their end time will be different than if they were not tested. The end time is conditional on the start time.
So, I have tried a few different equations with the IF function, which typically goes:
=IF (logical expression, value if true, value if false)
My attempt:
=IF(A1=TRUE, C1=B1+120/24, C1=B1+132/24)
I know the IF function is sensitive with dates, so this has brought on the issue.
Any advice or suggestions would be appreciated!
try:
=IF(A1=TRUE, B1+120/24, B1+132/24)
Related
I am trying to sum values using sumifs but I am getting an error. Went throught several website but I guess I don't have a good understanding of how SUMIF works.
Right now I have a sheet with a registry date(C), a price per weeek(G) and a end date(D).
I would want to calculate the earning every week.
So I created another sheet with every week of the year.
=SUMIFS(Clients!G2:G;A5;>=Clients!C2:C;A5;<=Clients!D2:D)
I am not using coma as a separator as my google sheet is not in english.
I am trying to sum the incomes if the date on the second sheet is between the starting date and the end date. But I keep getting errors and I don't really unerstand why.
Thanks
I found an formula which look to be working.
=SUMIFS(Clients!G2:G;Clients!C2:C;"<="&A5;Clients!D2:D;">="&A5)
I guess that it was not working because I was letting A5 to incremente.
Problem solved.
Thanks for your help.
Find out more here on Google's post about =SUMIFS().
Sample usage
SUMIFS(A1:A10, B1:B10, ">20")
SUMIFS(A1:A10, B1:B10, ">20", C1:C10, "<30")
SUMIFS(C1:C100, E1:E100, "Yes")
Syntax
SUMIFS(sum_range, criteria_range1, criterion1, [criteria_range2, criterion2, ...])
sum_range – The range to be summed.
criteria_range1 – The range to be checked against criterion1.
criterion1 – The pattern or test to apply to criteria_range1.
criteria_range2, criterion2, … (OPTIONAL) – Additional ranges and criteria to be checked.
I have a list of days and times in column A. Column B is a dollar value for each time value.
I want to get a specific time for each day and list the price in the next column. I have this right now:
The formula for column J is this:
=filter(A11:B,(mod(A11:A,1)*24)>=4.5,(mod(A11:A,1)*24)<=4.6)
This formula filters 4:30AM and the price associated with it.
Formula for column L is this:
=filter(A11:B,(mod(A11:A,1)*24)>=9.5,(mod(A11:A,1)*24)<=9.6)
Which filters only 9:30AM for each day and the price that goes with it.
As you can see, the dates stop matching when column J is 8/12/2021 and column L is 8/13/2021. This is because column L didn't have 9:30AM for 8/12/2021 so it skipped to 8/13/2021.
How can I make so that one of the columns skip a date if the other column doesn't match that time? I don't know if I explained that well but in the example above, column J should skip 8/12/2021 because column L didn't have 8/12/2021.
Another way of dealing with this issue is perhaps using UNIQUE and FILTER formulas but I'm not sure how that could be done. Any help would be greatly appreciated!
Here's a link to the spreadsheet: https://docs.google.com/spreadsheets/d/1TvP0_UsYJbLb5bscx2e4nTEnSkP5roBZpP8aIGdl414/edit?usp=sharing
I'm not 100% sure, but if you need to filter values so the time element is 09:30 and 04:30, then hide values where a date only occurs once (ie. no 09:30 value or no 04:30 value), you could use:
=arrayformula(filter(
filter(A11:B,(round(mod(A11:A,1)*24,2)=9.5)+(round(mod(A11:A,1)*24,2)=4.5)),
countif(int(filter(A11:A,(round(mod(A11:A,1)*24,2)=9.5)+(round(mod(A11:A,1)*24,2)=4.5))),int(filter(A11:A,(round(mod(A11:A,1)*24,2)=9.5)+(round(mod(A11:A,1)*24,2)=4.5))))>1)
)
Adjust >1 at the end to whatever logic you need (=2, <>1 etc).
You can also add sort() around everything if you need to.
Explanation:
It turns out that mod(A11,1)*24 doesn't round particularly well, so I suggest round(mod(A11:A,1)*24,2).
Therefore to filter the date/times for 9.30am and 4.30am, you can apply:
round(mod(A11:A,1)*24,2)=9.5
and
round(mod(A11:A,1)*24,2)=4.5
like this:
=arrayformula({filter(A11:B,(round(mod(A11:A,1)*24,2)=9.5)+(round(mod(A11:A,1)*24,2)=4.5))})
filter is usually AND but to get OR condition it's filter(A:B,(A=1)+(A=2))
This gets the dates only:
=arrayformula(int(filter(A11:A,(round(mod(A11:A,1)*24,2)=9.5)+(round(mod(A11:A,1)*24,2)=4.5))))
Then this counts how many times a date appears:
=arrayformula(countif(int(filter(A11:A,(round(mod(A11:A,1)*24,2)=9.5)+(round(mod(A11:A,1)*24,2)=4.5))),int(filter(A11:A,(round(mod(A11:A,1)*24,2)=9.5)+(round(mod(A11:A,1)*24,2)=4.5)))))
Combining the elements gets the solution.
I'll add a tab to your sheet.
You could filter each list on finding a match for each date (integer part of datetime) in the other list:
In J:
=filter(A11:B,(mod(A11:A,1)*24)>=4.5,(mod(A11:A,1)*24)<=4.6,isnumber(match(int(A11:A),int(filter(A11:A,(mod(A11:A,1)*24)>=9.5,(mod(A11:A,1)*24)<=9.6)),0)))
In L:
=filter(A11:B,(mod(A11:A,1)*24)>=9.5,(mod(A11:A,1)*24)<=9.6,isnumber(match(int(A11:A),int(filter(A11:A,(mod(A11:A,1)*24)>=4.5,(mod(A11:A,1)*24)<=4.6)),0)))
Note
Plz see Aresvik's answer for a possibly better approach to rounding, but note that 4:30 (3/16) actually has an exact representation as a binary decimal so rounding errors aren't an issue here.
I'm trying to create a fundraising spreadsheet that will say whether funders are currently open or closed for applications. Ideally this would be based on just the month and day, so it doesn't have to be updated every year, but I ran into problems with funding cycles that begin at the end of one year and end in the next (eg. Dec 2020 - Feb 2021). This is what I came up with to get around it, but is there a simpler way to achieve the same result?
It should return Open if today's date falls within the funding window; otherwise it should say Closed. Rolling deadlines are always Open. What I have currently returns the correct output but slows down the sheet. I'm also working with a group of volunteers with varying levels of computer skills and ideally would like to leave them with something that is easy to understand/maintain.
Here is a link to the demo sheet: https://docs.google.com/spreadsheets/d/1lHFd0f_y2PCzLSvXYM6XD1rCfdzCglsQvyfpu7xJiRQ/edit?usp=sharing
=IF(B77="rolling","Open",IF(YEAR(B77)=YEAR(C77),
IF(
AND(
DATE(YEAR(B77),MONTH(TODAY()),DAY(TODAY()))>=B77,
DATE(YEAR(C77),MONTH(TODAY()),DAY(TODAY()))<=C77),
"Open",
"Closed"),
IF(
OR(
DATE(YEAR(B77),MONTH(TODAY()),DAY(TODAY()))>=B77,
DATE(YEAR(C77),MONTH(TODAY()),DAY(TODAY()))<=C77),
"Open",
"Closed")))
I've added a new sheet ("Erik Help") to your sample spreadsheet.
I deleted your header and all of your row-by-row formulas from Column C and replaced them with the following single array formula in C1:
=ArrayFormula({"Status Today"; IF(A2:A="",,IF(ISTEXT(A2:A),"Open",IF((TODAY()>=A2:A)*(TODAY()<=B2:B),"Open","Closed")))})
This one formula will produce the header (which you can change as you like within the formula itself) and all column results.
First, an IF test is run to see if each cell in Column A is blank. If it is, then the corresponding cell in Column C is left null; otherwise the next IF test is initiated.
Since all of your dates are numbers, the second IF test simply checks to see if the value in Column A ISTEXT. If so, then we know it is "rolling," and the return value is "Open"; if not, then the final IF test is initiated.
The final IF test simply checks whether two parenthetical conditions are true (joined by the asterisk, which in array formulas, means AND). The two conditions are that TODAY() is greater-than-or-equal-to the value in Column A and that TODAY() is less-than-or-equal-to the value in Column B. If so, "Open" is returned; otherwise, "Closed" is returned.
I have the list of dates A and list of prices B.
Then manually filled search range in D and E.
I need to perform a search for number, that will be higher than G, or lower than H.
As result we show founded date in J. If no matching number is found, return E. Price (G or H), that triggered successful result in L. And founded price M, just B from date J.
Which functions can help me to implement this type of search? I tried to use INDEX, FILTER, but can't properly set the range like IF "HIGHER THAN" or "LOWER THAN" on every cell.
The main target is gradually checking each cell vertically, one by one, searching for a price, that will be higher or lower than sought. And if the number was not found, return the end date of the search.
Added the Google Sheets link, so you can test your solution and compare it.
https://docs.google.com/spreadsheets/d/1gmw7I778MGfCZENsOos4HhKB07X0wLp7fKs9hyn0a-Q/edit?usp=sharing
You can use following formulas:
for Expected result:
=IFERROR(INDEX($A$14:$A$23;MATCH(1;((D14<=$A$14:$A$23)*(E14>=$A$14:$A$23)*(((G14<=$B$14:$B$23)+(H14>=$B$14:$B$23))>0));0));E14)
for Triggered price:
=CHOOSE(1+(M14>=G14)+(M14<=H14)*2;"None";G14;H14)
for Founded price:
=IFERROR(INDEX($B$14:$B$23;MATCH(1;((D14<=$A$14:$A$23)*(E14>=$A$14:$A$23)*(((G14<=$B$14:$B$23)+(H14>=$B$14:$B$23))>0));0));ARRAYFORMULA(MAX($B$14:$B$23*(E14=$A$14:$A$23))))
See sheet "Search formula test" in your file.
To return date following formula is used
=IFERROR(IFERROR(INDEX(FILTER($A$14:$B;$A$14:$A>=D14;$A$14:$A<=E14;$B$14:$B>=G14);1;1);
INDEX(FILTER($A$14:$B;$A$14:$A>=D14;$A$14:$A<=E14;$B$14:$B<=H14);1;1));
MAX(FILTER($A$14:$B;$A$14:$A>=D14;$A$14:$A<=E14)))
Where it filters dates based on "Search from" / "Search until" data and Price check, first for "Higher than" then if no values found - for "Lower than".
Date result is returned with INDEX(filterFormula;1;1).
Last part MAX(FILTER()) returns last date in checked range in case no values were found.
For price the same formula is used but INDEX(filterFormula;1;2) returns price and last part VLOOKUPs price for last date in checked range.
However, there is a problem with using formulas as it first checks selected range for one condition and then for next one. Better solution would be script to check each cell in selection for both conditions.
I have a formula as follows which I'm using for a scheduling system within Google Sheets:
=IF(B2="","",(CONCATENATE($B$1&" "&B2&CHAR(10)&$C$1&" "&C2&CHAR(10)&$D$1&" "&D2&CHAR(10)&$E$1&" " &E2&CHAR(10)&$F$1&" " &F2&CHAR(10)&$G$1&" " &G2)))
currently my formula works b2 has a value inside it which is great, what I want however, is for the formula only to show if one value is inside either.
B2, C2, D2, E2, F2 or G2.
so if c2 has a value I want the formula to parse.
I've tried
=IF(B2,C2,E2) etc with no luck.
I've also tried:
=IF(OR(B2="",C2="") which parsed the formula but kept it visible even with no data.
Reason for this is that I pull these fields into a master schedule and I only want it to show when one of the fields is populated, if that makes sense? otherwise the schedule will look far to busy.
https://docs.google.com/spreadsheets/d/1KE3VOI43M4-QlWB0EZldCqR73d3RHDnRnUNlv1MqLMo/edit?usp=sharing
Document for you guys.
Cheers!
If your goal is to show a formula when any of a given range of cells is not empty (and display nothing if they are all empty), you can simplify your condition check by first joining all ranges, and then comparing to the empty string:
=IF(JOIN("", B2:G2)="", "", "Your Formula")
You need to use AND() instead of OR().
=IF(AND(B2="", C2=""), "", "Formula")
Also, although this makes the formulas longer, I do prefer to use a combination of IFERROR(), ISBLANK(), and NA(). I prefer this because a blank cell is not the same as one with an empty string in it. So my preferred way of writing the above would actually be:
=IFERROR(IF(AND(ISBLANK(B2), ISBLANK(C2)), NA(), "Formula"))
just another solution I came across which I thought was much better than my own and made the data above a little tidier.
=IF(A2<>"",CONCATENATE(IF(B2<>"",$B$1&": "&B2&CHAR(10),),
IF(C2<>"",$C$1&": "&C2&IF(OR(D2<>"",E2<>"",F2<>"",G2<>""),CHAR(10),),),
Essentially this will populate only whats selected instead of populating all the fields in headers and then populating the scheduled work stream.