Trouble with looking up min value between different conditions - excel

I am trying to find the minimum time for a fixed date between two different times.
Been trying out different variations but nothing works.
This is on excel 2016, I tried out yesterday with a similar code on a different spreadsheet (a test sheet I created) and it worked. Unfortunately it was on another laptop that I have no longer access to.
Tried out the same code on the sheet I am to use and it did not work.
{=MIN(IF((Date<=D5)*(Date>=D4);Time;"");IF((Time<=D7)*(Time>=D6);Time<""))}
{=MIN(IF(;IF((Time<=D7)*(Time>=D6);Time<""))}
D5 is the actual date I want to look at (line 1), since it did not work for my I tried out putting an earlier date in D4 but same result (line 2).
D7 and D6 is the end and start time I want to find the value between.
Tried naming the ranges so Date range refers to the dates (E2:E55220) and Time is the time range I want to find the minimum value in (C2:C55220).
Value I end up with on all attempts is 0

Alternative formula to the array. It should do the same thing:
=AGGREGATE(15,6,myTIME/((myDATE<=F4)*(myDATE>=F3)*(myTIME<=F6)*(myTIME>=F5)),1)
Now this formula works with the assumption that your dates are actual excel dates and not text looking like a date. Same goes for for time. You can test it with the following formula:
ISNUMBER(E2)
or
ISTEXT(E2)
Where E2 is a cell containing a date or a time. Excel stores dates as integers and times as decimals. IF your information is stored as text, it is probably easier to convert them first then trying to apply your formula con the converted results. you can convert withing your formula but it will tend to make the formula really ugly and long.

Related

Change cell color of cell if within 3 days of cell date

I am attempting to make a cheat-sheet for paperwork that needs to be submitted at a specific date. Cell A8 is the given date; cells B8-F8 have formulas to generate dates based on A8's given date. I want cells B18-F8 to turn red 3 days before the generated dates, and stay that way until the due date passes (for now).
I have tried: =$FD8<=FD8 - (3) with every variation of "<,>,<="
Most solutions me to use "TODAY()" but I specifically want it to go off of the given date.
Can anyone point me in the right direction? Thanks!
It would be most convenient to use another set of cells to generate the B8-F8 dates and to substract three days. For example, B9-F9. Then you can use conditional formatting to format B8-F8 based on the B9-F9 values.
To substract days you can generate a VBA code that creates a custom function.
Function myDateAdd(interval, howmany, adate)
myDateAdd = DateAdd(interval, howmany, adate)
End Function
Or write a more elaborate formula
=IF(
DAY(B8)>3,
DATE(YEAR(B8),MONTH(B8),DAY(B8)-3),
DATE(YEAR(B8),MONTH(B8)-1,(DAY(B8)-31)*-1)
)
You still need to write something extra to verify that the B8 date has 31 (or 30 or 28) days. Combine IF() and ISDATE() multiple times to achieve this.

Find minimum date in row with multiple data types in Excel

I am trying to find the minimum date in a row that has both dates and number data types. I tried to use the MINIFS function but that still produces the number value as the minimum, rather than the date. I am restricted to doing this as an in-cell function, rather than in VBA. Also, the data structure is a bit wonky, I know, but it can't be changed.
=MINIFS(A2:C2,A2:C2,CELL("format",A2:C2)="D4")
When I enter =MIN(IF(A6:C6>40000,A6:C6)) I get a #Value error. Excel doesn't like the range before the > symbol.
Remember that dates in Excel are calculated as number of days starting from January 1st, 1900.
Thus, if you look at your dates as numbers, you will see that it's in fact a number '44042'.
Knowing that, you can use MIN together with IF formula:
=MIN(IF(B5:D5>43831,B5:D5))
Where your suggested numbers are in cells B5:D5 and '43831' is 2020/01/01.
Of course, if you have numbers with high values, this solution should be adapted.
Here's a screenshot I made:
img

Excel count cells where difference between dates is between a range

I have a spreadsheet tracking issues and have various columns related to each issue, including the date the issue was discovered (column C), the date the issue actually started (column P), the date the investigation was started (column L), and the date the investigation ended and the issue was resolved (column M). I want to track how long an investigation has been open, how long it takes to complete an investigation, the time the issue started till it was discovered, and how long an issue was open; for each aspect I want to track, I'm grouping the counts into ranges (i.e., issues open 30 days or less, issues open between 31 and 60 days, etc.).
I was able to get the count of open issues using this formula (this one is for the 31 to 60 day grouping): =COUNTIFS($M:$M,"",$L:$L,"<"&TODAY()-31,$L:$L,">="&TODAY()-60)
However, I haven't been able to figure out the formula for the other things I want to track. Here's one formula I tried for tracking completion time: =COUNTIFS($M:$M,"*",$L:$L,"<"&$M:$M-31,$L:$L,">="&$M:$M-60). This formula returns 0 and when looking at the Function Arguments window, I get a #VALUE! error for Criteria2 ("<"&$M:$M-31) and Criteria3 (">="&$M:$M-60).
I'm guessing the issue is the date I'm trying to use in the second formula is not a constant like TODAY() is in the first formula but my Google skills haven't been sufficient to find an answer. Any ideas?
You're right about criterias, COUNTIFS can't handle the criteria specified as an range. The SUMPRODUCT function should be used instead. Without seeing a sample, it is difficult to say exactly, but the problematic formula could be modified as follows:
=SUMPRODUCT(($L2:$L1000<$M2:$M1000-31)*($L2:$L1000>=$M2:$M1000-60))
Use the exact range, not the entire column. You can include empty cells, but not text (eg column names) or other non numeric data that may interfere with the calculation M-31 or M-60

Getting minutes between different dates in excel

I'm trying to calculate the time between the dates , at the beginning the formula
was working fine but I've noticed that it does not work when the date is different
For example , I have the following information on cell A1: 09/15/2016 10:00 AM
On Cell B2 I have: 09/16/2016 10:00 AM
The formula is just B2-A1 but instead of giving me a result of 24 hours is just giving me 0 . I believe the formula is not recognizing that these are 2 different days and is just doing 10-10
Any idea how to fix this ?
I was able to get the result 24 by setting a custom format of [h] (you will have to type it into the 'Type:' box) on cell C1 while using the formula =B1-A1
Excel Reference
'Format Cells' view
The problem with just using =B1-A1 is that if either or both of those cells is not populated then you will get weird numbers in C1. You may want to make C1 display as a blank cell unless both boxes are populated, try something like this =IF(OR(ISBLANK(A1),ISBLANK(B1)),"",B1-A1)
The reason for the weird numbers is that Excel calculates time based on a predefined decimal system that indexes time starting at like 1/1/1900 or something like that. So when manipulating or calculating time, that is something that you always have to keep in the back of your mind.
Hope this helps.
Formation the destination cell to will do but since you have date and time combined it will show as 1 calendar day difference 0 only means that 12 am after the 1 day difference, I know it does not make any sense but its Excel...
If I was you, on column A, I would add the date, and on Column B, the time.
then just work with the time, as both combined can be tricky
Don't forget to format your cells!! (right click>Format Cells>Time>3/14/12 1:30 PM)

EXCEL: Counting worksheets dynamically using INDIRECT

I've come across several discussions on using INDIRECT and 3D references, however none seem to address (or fix) this problem specifically.
I'm trying to count the position of a worksheet without using VBA. Each sheet represents a month, and has a standardized name (e.g. JAN-15, FEB-15, MAR-15, etc.). My idea is to find the position by counting the number of sheets between JAN-15 and the current sheet. A1 of each sheet = 1, which gets summed across the sheets using a 3D reference.
Using February as an example, I can hard code this with no problem:
=SUM('JAN-15:FEB-15'!A1)
When I do this, I get the expected result of 2. However, I want each month's sheet to dynamically generate its position without having to change the formula each time. So I tried this:
Cell named FIRSTMONTH ='JAN-15
Cell named CURRMONTH =RIGHT(CELL("FILENAME",A1),6)
N1 =CONCATENATE("'",FIRSTMONTH,":",CURRMONTH,"'!A1")
(N1 evaluates correctly as 'JAN-15:FEB-15'!A1)
When I try this formula to generate the position:
=SUM(INDIRECT(N1))
I get a #REF! error. I've also tried this variation:
=SUM(INDIRECT("N1"))
Which returns 0.
Anyone have an idea of how I can get this to work? Or is there a better way that doesn't use VBA?
-David
Assuming you won't have any gaps perhaps try counting the number of month between the first month and the current one, e.g.
=DATEDIF(FIRSTMONTH,CURRMONTH,"m")+1

Resources