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
Related
I am trying to find a difference between 2 dates using networkdays and additionally if both dates are equal, have to make the value as 0. But unable to get the result.
You can try
if(DATEVALUE(A1)=DATEVALUE(A2),0,NETWORKDAYS(A1+1,B1)
#Ron Rosenfeld has pointed out that my testing led to wrong conclusions. Therefore I increased the volume of my tests. They continue to show that ...
Comparing the two dates and adding a day gives erratic results, and that
The naked NETWORKDAYS function as designed by Microsoft gives the most useful result.
In the table below the original function is in column C, your function (modified to work by #Ron Rosenfeld) in column D and two variations thereof in columns E and F. The lower part of the table shows results where both days are the same while the dates are 2 days apart in the upper part.
The tables show that the original formula counts both the start and the end days as well as all days between them, subtracting weekend days, except when start and end days are the same. In other words, the original function already treats the case of A1=B1 differently.
However, if an adjustment is to be made it should preferably be made to the result of the formula, not be modifying the date before they are processed. This is demonstrated in column F.
The formula in column E takes up your attempt to modify one of the dates (the end date could be modified too) and makes this conditional. The difference as compared to your formula is that you apply in fact two separate calculations, one where the result is always 0 (when dates are equal) and the other where the start date is advanced by one day unconditionally. If it suits your purposes that method can still be applied but the formula in column E shows how the date modification can be made conditional.
The need to apply conditions arises from the essential shortcoming of your formula in that it applies the wrong condition. Different treatment for when dates are equal is already incorporated in the basic function. Any further modification must take the involved weekdays into account, not (necessarily) only the interval between the dates.
Why do you put your formula arguments in quotes? That just changes them into strings, which is why your formula doesn't work.
I assume from your formula that you just don't want to count the first day. In which case it will work as you have it, if you merely remove the double quote marks.
Excel formula stop working after x number of rows
A similar question was posted 4 years ago. There were two answers. I have reviewed both. The first response is excellent but it is not the cause of my issues. The second answer was a statement that the person who responded had the same issue and what he or she did to solve it which will not work in my case. There was no explanation as to why the problem occurred.
Here is my problem. I am using the following formula:
IF(MONTH(MDB.xlsx!Date)=7,SUMIFS(MDB.xlsx!_910,MDB.xlsx!Activity,"MGRINC",MDB.xlsx!AcctNum,$Y202),0)
MDB is a Master Data Base. It currently has 214 rows but will grow substantially to probably around 5000 rows. The named ranges in the MDB are currently defined as rows 1 to 500. The above formula is in a spreadsheet, with about 300 rows. The formula works fine through row 201. From 202 on, it only returns zeros.
This is what I have done:
I have looked at constituent parts of the formula using F9, all values and arrays are reporting correctly. (That’s why the defined name range is currently set to only 500 rows, so I can breakdown a formula using F9 and not get an error after 8,192 characters.)
If I move the line with this formula from line 202 to an earlier row, it works fine.
If I delete earlier rows, the formula works fine.
This appears to be a memory issue of some sort but I don’t understand why. I have built larger and much more complex spreadsheets some of which take minutes to calculate with no issues.
Any thoughts?
Extracting the Month inside a Sumif will not work. You could add two conditions, one testing for the date being greater/equal to July 1, the second testing for the date being smaller/equal to July 31.
=SUMIFS(MDB.xlsx!_904,MDB.xlsx!Date,">="&date(2020,7,1),MDB.xlsx!Date,"<="&date(2020,7,31),MDB.xlsx!Activity,"MGRINC",MDB.xlsx!AcctNum,$Y202)
Or, you could add a column to your source data that has the month number, then test for that month number
Or, you could change the formula to use SumProduct instead of Sumif, incorporating the month filter into the SumProduct parameters like this:
=Sumproduct((MONTH(MDB.xlsx!Date)=7),--(MDB.xlsx!Activity="MGRINC"),--(MDB.xlsx!AcctNum=$Y202),MDB.xlsx!_910)
With the formula just testing form Month number, the year is disregarded, so if you have data spanning multiple years, you may want to add a parameter that checks the year.
Note that all these formulas are regular formulas and do not need to be array entered.
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.
I have tried to see if this question has been asked before, but I can't seem to find an answer.
I have a column of cells (>3000 rows), with either a value of 1 or 0 (call this column A). The value will depend on the value in column B (which will contain either a value or nothing). The values in column B are a SUMIFS function based, summing from column C, and based on months in column D.
The values in B are paid out on the first business day of the next month. So, the SUMIFS function will calculate the dates that match the last month. This works well in theory, however, not every first business day is the first day of the month. This leads the SUMIFS function to not include everything in the correct month, and allows for some discrepancy, which, when you are dealing with people's money is not great. Further, this discrepancy is compounded across multiple periods (in some cases, there are over 100 periods, and a discrepancy of $1 in period 1 amounts to nearly $1000 in period 100)
What I am wondering is:
Is there any way that I can tell the SUMIFS function (column B) to stop when the value in column A is 0? This would tell the SUM function start the summing from the current value in column B and continue the function to the cell below the preceding value in column B.
I've seen suggestions that the MATCH function may work, but I can't see how to do this with either COUNT or SUM.
For security reasons, this solution needs to be entered into the cell, and can't be VBA. Also, it can't be too large, as it will need to be replicated across 200 worksheets in the workbook (not my file originally, and I would have done it differently, but that is another story). There is no problem entering another column or two if that is required.
Any help is gratefully appreciated.
EDIT:
Unfortunately, I can't post an image of the screenshot. I've included a similar screenshot (columns are not the same layout, but hopefully it gives the idea) here:
Rates calculations
The SUMIF formula is (for B2)
=SUMIFS(C2:C35,D2:D35,D2-1,A2:A35,1)
This works fine if I want all the values in the month, irrelevant of when the payment was made.
However, what I need the formula to do is:
SUM (C2:C35,D2:D35,D2-1, but stop when the first 0 is encountered in A2:A35)
Thanks
The INDEX function can provide a valid cell reference to stop using a MATCH function to find an exact match on 0.
This formula is a bit of a guess as there was no sample data to reference but I believe I have understood your parameters.
=SUMIFS(C2:index(C2:C35, match(0, A2:A35, 0)), D2:index(D2:D35, match(0, A2:A35, 0)), D2-1)
This seems to be something that will stand-alone and not be filled down so I have left the cell addresses relative as per your sample(s).
I am somewhat new to writing large, complicated formulas with excel. I took over a report from someone about 7 months ago and it seems that every week I find issues with what was written with his formulas.
This week I am having issues with a match formula. We have a report we run for a big hardware store and they report based on weeks. This last week was 201501 (2015, week 1.) Last week was 201452 (2014, week 52.)
To look at 4 week sales averages, my predecessor setup 4 numbers that would change every week based on the week you type in one of the column headings. So, when I type 201452,
#1 is 201449
#2 is 201450
#3 is 201451
#4 is 201452
He feeds those into a match function.
I found this week that 201501 does not correctly display the weeks. I got
Results Formula Used
201501 =D1 (The cell where you type the Store's week)
201500 =IF(M1=201301,201252,IF(M1=201401,201352,M1-1))
201499 =IF(L1=201301,201252,IF(L1=201401,201352,L1-1))
201498 =IF(K1=201301,201252,IF(K1=201401,201352,K1-1))
I changed those formulas
Results New Formula
201501 =D1
201452 =IF(RIGHT(M1,2) = "01",(LEFT(M1,4) - 1)&"52",M1-1)
201451 =IF(RIGHT(L1,2) = "01",(LEFT(L1,4) - 1)&"52",L1-1)
201450 =IF(RIGHT(K1,2) = "01",(LEFT(K1,4) - 1)&"52",K1-1)
However, the match formulas he has setup throughout the workbook have not been fixed. They are still displaying "#N/A." One such formula is
=INDEX(N5:DZ5,1,MATCH(Data!$L$1,$N$1:$ED$1,0))
This formula basically looks at the column headers, and if it sees that the column header matches the week I've typed, will display the value within that range.
Basically, any formula that's being fed the 201452 value is returning "#N/A". The other numbers miraculously display data.
I've already tried converting all of my data in the affected rows to "General" format type. I've tried checking to see if I have spaces before or after in all of my formulas and column headers, but am still having no luck.
Any ideas?
After trying and trying and trying, I found that Excel does not like the concatenation. Trim does not help, Text does not help, Concatenate of course did not work.
I ended up realizing I could simply write
=IF(RIGHT(M1,2) = "01",M1-49,M1-1)
This makes it so that in the instance where the number to the right of it is the first week, subtract 49 days and produce 52 instead of 00.
I'm guessing here, but it could be that your formulas are presenting the Year/Week combo as a number, where the Match formula is looking for text (for Excel's purpose, it doesn't recognize them as the same).
You can get around this, by wrapping your formulas above with the text formula
So you'd have the following:
Results New Formula
201501 =TEXT(D1,"0")
201452 =TEXT(IF(RIGHT(M1,2) = "01",(LEFT(M1,4) - 1)&"52",M1-1),"0")
201451 =TEXT(IF(RIGHT(L1,2) = "01",(LEFT(L1,4) - 1)&"52",L1-1),"0")
201450 =TEXT(IF(RIGHT(K1,2) = "01",(LEFT(K1,4) - 1)&"52",K1-1),"0")