Multi Condition Array With DateValue - arrays

I'm looking to create an Array Formula in Google Sheets that checks if two dates are within certain time periods.
Currently, I am using:
=ARRAYFORMULA(IFERROR(IF(DATEVALUE($B3:$B)-DATEVALUE($A3:$A)<E2,TRUE,FALSE),"")
Which is giving me the following results:
The issue is that if a value is True within 90 days, it remains true within 7300 days. I would like each column to be exclusive to its current period. I had hoped the following would work, however it just makes everything to True.
=ARRAYFORMULA(IFERROR(IF(DATEVALUE($B3:$B)-DATEVALUE($A3:$A)<90 & DATEVALUE($B3:$B)-DATEVALUE($A3:$A)>1095,TRUE,FALSE),""))
Anyone know if there is a way for this to work? I appreciate it a ton.

try:
=ARRAYFORMULA(IF(A3:A="",,{DAYS(B3:B, A3:A)<C2,
(DAYS(B3:B, A3:A)>=C2)*(DAYS(B3:B, A3:A)<D2)=1,
(DAYS(B3:B, A3:A)>=D2)*(DAYS(B3:B, A3:A)<E2)=1,
(DAYS(B3:B, A3:A)>=E2)*(DAYS(B3:B, A3:A)<F2)=1}))

Related

Lightning Flow Builder - compare a date field to $Flow.CurrentDate

I'm looking for a way to set a condition requirement that a specific date field will be equal to today's date, or yesterday's.
How do I do it?
Add a new formula resource of type Date and name it yesterday (or whatever) and put that code in there.
{!$Flow.CurrentDate} - 1
Edit: I am not sure if you are doing something differently but here is a screenshot of a Get Records flow element filtering based on a formula value:
And to be perfectly clear, here is a screenshot of that formula definition:

How do I forward an array value using an if statement comes back false?

I am trying to only pull lunch times in an array if they are over an hour long and display the full value of that time.
I've tried to use an if statement to wrap the entire code and increment if false by one. I've been searching forms trying to see what I am doing wrong but not able to find anything. I have one functioning formula that will pull all break times and display time and dates but does not work when I try to use it to find specifics ones.
Two cells that are working:
Date it happened: {=IFERROR(INDEX(Time,SMALL(IF(Reason=$K7,ROW(Duration)-MIN(ROW(Duration))+1),COLUMNS($K$7:K7))),"")}
Value of Duration: {=IFERROR(Duration(Time,SMALL(IF(Reason=$K7,ROW(Duration)-MIN(ROW(Duration))+1),COLUMNS($K$7:K7))),"")}
The formula I am trying:
{=IF(INDEX(Duration,SMALL(IF(Reason=$K7,ROW(Duration)-MIN(ROW(Duration))+1),COLUMNS($K$7:K7)))>=TIME(1,0,0),IFERROR(INDEX(Duration,SMALL(IF(Reason=$K7,ROW(Duration)-MIN(ROW(Duration))+1),COLUMNS($K$7:K7))),""),IFERROR(INDEX(Duration,SMALL(IF(Reason=$K7,ROW(Duration)-MIN(ROW(Duration))+1),COLUMNS($K$7:L7))),""))}
That formula does ignore the times that are under an hour however it pulls the same data twice. For Example the first duration formula displays the following:
1:11:46 0:59:28 1:11:51 1:10:59
The second one shows:
1:11:46 1:11:51 1:11:51 1:10:59
My ultimate goal is to have it look up a name and then for breaks/lunches but for right now I just want to to look up the lunch times. I would like it to make the output of 1:11:46 1:11:51 1:10:59 . Any thoughts?
=IFERROR(INDEX(Duration,SMALL(IF((Reason=$K7)*(Duration>=TIME(1,0,0)),ROW(Duration)-MIN(ROW(Duration))+1),COLUMNS($K$7:K7))),"")
^ That fixed it

Excel IF Function Query - Dates

I am looking for some help regarding an IF function on an Excel document.
Basically if the Date Listed cell is dated over 1 month ago (eg: Date Listed 6-Aug but today is 6-Sep) and the Date Sold cell is blank, then I would like the Mark Down cell to say 'MARK DOWN', which at the moment it does but it is only 10-Aug today.
If the Date Listed cell and the Date Sold cell both contain dates I would like the Mark Down cell to say 'OK'.
So far I have this written:
=IF(AND(DATE(YEAR(G2),MONTH(G2),DAY(G2)), ISBLANK(H2)),"MARK DOWN","OK")
I know I'm not far off but I need help sorting out the last parts..
Bonus if you can help me add a highlighted cell formatting to it :)!
[EXAMPLE IMAGE]
I think this should work
IF(AND((TODAY()-g2)>31,ISBLANK(H2)),"Mark Down","OK")
Apply conditional formatting on all the cells in MARK DOWN column which are equal to OK.
After that write this simple formula to check the condition.
=IF(AND(ISNUMBER(G2),ISNUMBER(H2)),"OK","MARK DOWN")
Update: if you use EDATE function everything gets simplified as this function takes care of exact day differences
so the whole solution is :
=IF(AND(EDATE((G2),1)=EDATE(NOW(),0),ISBLANK(H2)),"MarkDown","")
Let me know if you have any question on how this formula works.

MS Excel 2010 Count unique values with multiple criteria and EDATE

I am trying to get a count of all Unique values listed in Col A, by state and within a date range, for example all records up to the end of April 2018.
I am able to get the count of Unique values by state (result is 2) with the below formula:
{=SUMPRODUCT(1*(FREQUENCY(IF($C$2:$C$14=F10,MATCH($A$2:$A$14,$A$2:$A$14,0)),ROW($A$2:$A$14)-ROW($A$2))>0))}
but I am unable to get the IF function to work with EDATE. I tried the following but I'm getting 0 as the result. The result should be 1.
{=SUMPRODUCT(1*(FREQUENCY(IF(D2:D14="<"&EDATE(G1,1),IF($C$2:$C$14=F10,MATCH($A$2:$A$14,$A$2:$A$14,0))),ROW($A$2:$A$14)-ROW($A$2))>0))}
I am unable to use Pivot as I need to include date range filter. Could someone please look at my code and tell me what I'm doing wrong? I am using CSE with my formulas. Thankyou!
I managed to work it out. EDATE wasn't working so I entered the Month date in cell:G1 then referenced it in the IF formula using "<=" eg: IF(D2:D14<=G1).
Whole array formula is:
`{=SUMPRODUCT(1*(FREQUENCY(IF(D2:D14<=G1,IF($C$2:$C$14=F10,MATCH($A$2:$A$14,$A$2:$A$14,0))),ROW($A$2:$A$14)-ROW($A$2))>0))}
I now receive the correct count of 1, though I have to ensure I have entered the last day of the Month in G1. State is referenced in F10 and count of unique values is in Column A.
My full data set is sourced from multiple documents over 5000 rows each and growing daily so my workbook is quite slow to calculate over 1000 array formulas... but it works!
If anyone knows of a faster (possibly non-array) formula, I would appreciate the advice! Thanks!

Excel 2016 Complex Nested IF

I'm working with an Excel sheet with more than 2,000 rows. The image I've attached shows the problem. I've checked the questions on StackOverflow & I don't see anything addressing this situation:
I need a formula to calculate the percentage in column E (E is formatted as a percentage). I can do this by hand logically but it takes upwards of 15 minutes and the report needs to be produced daily. The list comes from SQL Server and I can't get my SQL query to handle this either, nor can I make it work in VBA for Excel.
Logic for Cell E3:
If C2='house' and C3='house' and C4='house', then '100'
If C2='house' and C3='house' and C4='prospect', then 'C3/SUM(C3:C4)'
If C2='house' and C3='prospect' and C4='house', then 'C3/SUM(C2:C3)'
If C2='house' and C3='prospect' and C4='prospect', then 'C3/SUM(C2:C3)'
If C2='prospect' and C3='prospect' and C4='prospect', then '100'
If C2='prospect' and C3='house' and C4='house', then, '100'
If C2='prospect' and C3='house' and C4='prospect', then 'C3/SUM(C3:C4)'
If C2='prospect' and C3='prospect' and C4='house', then '100'
Thank you, in advance, for any assistance!
Obviously there was a typo in your question, you meant to calculate with numbers on column D not C, i.e D3/Sum(D3:D4) etc.
You could try to simply write that logic with nested if's... But I realize that the rule, which looked like a digital logic exercise, is actually much simpler. In summary the equation should detect the flip from "House" to "Prospect", if any.
Try this formula at E3 and copy it down:
E3:
=D3/(D3+ (D2*(C2="House")*(C3="Prospect")) + (D4*(C3="House")*(C4="Prospect")))

Resources