Countif function for multiple criteria - excel-formula

I am trying to create a formula in Excel that will count cells with 3 certain criteria. My example is below: cell M3:M350 is the name, cell Q3:Q350 is the date, cell R3:R350 is the current step. I need to know how many times the name Amanda shows up that is in the current step of Material Review, and that is also 30 days or less than the date in cell Q3:Q350. The formula I have been trying is:
=COUNTIFS('Active Projects'!M3:M350,"AMANDA MARTIN",'Active
Projects'!Q3:Q350,"<="&NOW+30,'Active Projects'!R3:R350,"*MATERIAL REVIEW")
The answer keeps giving me 0, and it should be 1.
Does anybody know the correct formula to use? It has been eating at me for a week now, and I have tried different variations, and still cannot get it to not count the dates older than 30 days from today.

please update your formula as follows:
=COUNTIFS('Active Projects'!M3:M350,"AMANDA MARTIN",'Active Projects'!Q3:Q350,"<=" & TODAY() + 30,'Active Projects'!R3:R350,"*MATERIAL REVIEW")
Structure you have used for date is not correct:
=COUNTIFS('Active Projects'!M3:M350,"AMANDA MARTIN",**'Active
Projects'!Q3:Q350,"<="&NOW+30**,'Active Projects'!R3:R350,"*MATERIAL REVIEW")
there should be brackets () after NOW or TODAY functions.

Related

Formula to Count Numbers in a Range IF the Cell Above it has a Specific Text

I'm trying to count the number of days in a cell if the cell above it has a specific NAME.
Basically trying to calculate the number of days someoone works.See this image. (https://i.stack.imgur.com/sxH20.png).
I'd love some help with a formula.
I've trying countif and offset, but I can't seem to make it work.
This is what i tried: =COUNTIF(Offset(D6:J6,-1,0,0)="Name 1")
Here's a sample setup with a formula:
=SUM(IFERROR(FILTER(D7:L7,D6:L6=C11)))
ALTERNATE FORMULA:
=SUMIF(D6:L6,C11,D7:L7)
UPDATE:
Week:=SUM(IFERROR(FILTER(D7:L7,D6:L6=C11,REGEXMATCH(D2:L2,"Week\b"))))
Weekend: =SUM(IFERROR(FILTER(D7:L7,D6:L6=C11,REGEXMATCH(D2:L2,"Weekend"))))
-

If date is older than 6 months and value is X, then output this

I have two columns in excel, one with a date and one with a rating 'low, medium, high'.
I'm trying to write a formula to put in a third column that checks:
If A2 = Low and B2 (date) is older than 12 months from today(), output Overdue
If A2 = Medium and B2 (date) is older than 6 months from today(), output Overdue
If A2 = High and B2 (date) is older than 3 months from today(), output Overdue
If these parameters aren't met, output "Current".
This is what I have so far but I'm well aware its not right :)
Could someone please point me in the right direction?
Thanks,
=IF(AND(A2="Low",LOOKUP(DATEDIF(B2,TODAY(),"m"),{0,3,6,12},{"Current", "Current" "Current","Overdue"}),(A2="Medium",LOOKUP(DATEDIF(B2,TODAY(),"m"),{0,3,6,12},{"Current","Current","Overdue","Overdue"}),(A2="High",LOOKUP(DATEDIF(B2,TODAY(),"m"),{0,3,6,12},{"Current","Overdue","Overdue","Overdue"})
If you can use the excel 365 then I’d suggest creating an excel lambda function:
=LAMBDA(level, date, LET(months, IFS(level="Low",12,level="Medium",6,level="High",3,TRUE,0), IF(date < EDATE(Today(), -months),"Overdue", "Current")))
so to break it down, this is a custom function that expects 2 parameters :
level is the value/reference that has low/medium/high. this is used to determine the number of months for the threshold - 12/6/3 respectively and 0 for anything else though you could change that as needed.
date is the date to check if its beyond the threshold. this is compared against today minus the number of months calculated from the level. if this is before that date then this function will return “Overdue”. otherwise “Current”.
You would create a workbook level named reference with this function as the value.
Here I named it IsCurrent. Then you just use that function where you want the output. e.g.
What I would suggest is to "outsource" the settings for the overdue months.
This is a good habit, as everyone looking at the table can see those settings and propably adjust them - without going into the formula.
And it is possible to use these settings in another formula :-)
If you use Excel 365 you can make the formula more readable/understandable with the LET-Formula.
=LET( OverdueMonthsForRating, IFNA(INDEX(configOverdue[Overdue months],MATCH([#Rating],configOverdue[Rating],0)),0), OverdueDate,IF(OverdueMonthsForRating>0, EDATE([#Date],OverdueMonthsForRating),TODAY()), IF(OverdueDate<TODAY(),"overdue","current") )
OverdueMonthsForRating is using a classic INDEX/MATCH to retrieve the number of months according to the Rating. In case Rating is not found 0 is returned
OverdueDate calculates - using EDATE - the overdue date based on the ratings date and OverdueMonthsForRating. In case Rating is not found TODAY is returned
Finally this date is evaluated against TODAY and the status is returned.
Classic Excel formula w/o LET:
=IF(EDATE([#Date],IFNA(INDEX(configOverdue[Overdue months],MATCH([#Rating],configOverdue[Rating],0)),TODAY()))<TODAY(),"overdue","current")

Purely excel formula with network days

I have this spreadsheet to track how long a team is taking to complete customer requests. I've coded the net days considering holidays and work week for different team members but when 'L2' is blank (case completed date) my formula is returning odd values such as '30520'
I want to tell excel that is L2 is blank, then ignore my formula and leave the cell blank, else display the calculated value. I am also okay with displaying OPEN if L2 is found empty. This is what my formula looks like:
=IF(OR(B2="Jack", B2="Jill"),NETWORKDAYS.INTL(K2,L2,1,O$2:O$11),
NETWORKDAYS.INTL(K2,L2,7,Q$2:Q$26))
Where:
B2 = case owner
K2= case received date
L2 = case completed date
O = set of US holidays
Q = set of intl’ holidays
Thanks!
I want to tell excel that is L2 is blank, then ignore my formula and leave the cell blank
Well, that's easy enough to do with just any formula: Wrap another IF statement around the formula
=if(L2="","",<theFormula>)
I got the answer to this in a different forum. I used the following:
=IF(L2="","OPEN",IF(OR(B2="Jack", B2="Jill"),NETWORKDAYS.INTL(K2,L2,1,O$2:O$11),NETWORKDAYS.INTL(K2,L2,7,Q$2:Q$26)))
Also, I formatted my target cell as "general" and it worked wonders!

IF formula to compare a date with current date and return result

I'm looking for a formula which allows me to look at a cell and check if it greater than or equal to today's date and to return a worded result such as "overdue". If it is blank to return another word, or nothing.
I have tried copying the result from the source cell (O10) into another cell (Y10) and used an if statement but this seems overly laborious - there must be a way to read the information from the source cell? See below. It also returns overdue when the cell is blank :(
=IF(O10>Y10,"OVERDUE","NOT DUE")
You can enter the following formula in the cell where you want to see the Overdue or Not due result:
=IF(ISBLANK(O10),"",IF(O10<TODAY(),"Overdue","Not due"))
This formula first tests if the source cell is blank. If it is, then the result cell will be filled with the empty string. If the source is not blank, then the formula tests if the date in the source cell is before the current day. If it is, then the value is set to Overdue, otherwise it is set to Not due.
I think this will cover any possible scenario for what is in O10:
=IF(ISBLANK(O10),"",IF(O10<TODAY(),IF(TODAY()-O10<>1,CONCATENATE("Due in ",TEXT(TODAY()-O10,"d")," days"),CONCATENATE("Due in ",TEXT(TODAY()-O10,"d")," day")),IF(O10=TODAY(),"Due Today","Overdue")))
For Dates that are before Today, it will tell you how many days the item is due in. If O10 = Today then it will say "Due Today". Anything past Today and it will read overdue. Lastly, if it is blank, the cell will also appear blank. Let me know what you think!
The formula provided by Blake doesn't seem to work for me. For past dates it returns due in xx days and for future dates, it returns overdue. Also, it will only return 15 days overdue, when it could actually be 30, 60 90+.
I created this, which seems to work and provides 'Due in xx days', 'Overdue xx days' and 'Due Today'.
=IF(ISBLANK(O10),"",IF(DAYS(TODAY(),O10)<0,CONCATENATE("Due in ",-DAYS(TODAY(),O10)," Days"),IF(DAYS(TODAY(),O10)>0,CONCATENATE("Overdue ",DAYS(TODAY(),O10)," Days"),"Due Today")))

SUM data according to dates in Excel

My problem is the following...
I have a little aeroplane and I need to track the hours. I have to track the hours by sectors and not the total of the day (that's why sometimes I have 2 or 3 on the same day).
Now this is the problem... On column C I need to SUM the hours of the last 7 days. And any given 7 days, not just last week. To do it manually is quite easy... the problem is that I need a formula as my records are quite large...
Here with a small example (let's say that there was NO HOURS before 15/01/2009)...
COLUMN A-------COLUMN B-------COLUMN C
DATE--------------HOURS-------HOURS LAST 7 DAYS
15/01/2009-------01:00-------01:00
15/01/2009-------02:15-------03:15
16/01/2009-------01:15-------04:30
17/01/2009-------01:30-------06:00
18/01/2009-------01:30-------07:30
18/01/2009-------01:00-------08:30
18/01/2009-------02:00-------10:30
19/01/2009-------02:30-------13:00
19/01/2009-------03:00-------16:00
20/01/2009-------////////--------16:00
21/01/2009-------01:00-------17:00
22/01/2009-------01:30-------15:15
23/01/2009-------02:00-------16:00
I've been fighting for the last weeks trying to figure out a formula but no luck... any suggestions?
Thanks
Another solution that basically does much the same as the earlier offered solutions:
In C1, enter the following formula:
{=SUM(IF(($A$1:$A1>=($A1-6))*($A$1:$A1<=$A1), $B$1:$B1, 0))}
And then just drag the formula down.
If you're not familiar with array formulas, the {} outer brackets just indicate that the formula is an array formula. To get it to execute correctly, you need to copy the part inside the {} brackets into the formula bar, and then hit Ctrl+Shift+Enter to indicate that it's an array formula.
First thing is to get the begin date, which would be the following function:
=Now() - 7
If you renamed that cell to "WeekBegin", then you could use the following formula to calculate the total hours:
=SUMIF(A:A,">=" & WeekBegin,B:B)
Notice that I used column references; this was to both simplify the formula, but also allow you to add new data to the end of the range easily. You will need to take care that your WeekBegin cell is not in that column A or column B, otherwise you'll get a circular reference warning.
If you planned to have numeric data above or below your input range, you would need to explicitly call out the sum and criteria ranges as follows:
=SUMIF(A2:A14,">=" & WeekBegin,B2:B14)
Additionally, you may find that your result comes up initially as a decimal. That's Excel's date serial format, so you may need to format your result as time.
Hope that helps!
[Edit: On second pass, if you're looking to sum a range based on a from and to date (so any 7 days as you seem to imply in your post), look for the previous poster's note, i.e.:
=SUM(B:B) - SUMIF(A:A, "<="& BeginDate, B:B) - SUMIF(A:A, ">"& EndDate, B:B)
A more elegant solution is offered in Excel 2007 using the SumIFS() function:
=SUMIFS(B:B, A:A, ">=" & FromDate,A:A, "<" & ToDate)
Note that the arguments for SUMIFS are in a different order than the standard SUMIF.
Happy Summing!]
Here's the data in better format if someone wants to try:
15-Jan-2009 01:00
15-Jan-2009 02:15
16-Jan-2009 01:15
17-Jan-2009 01:30
18-Jan-2009 01:30
18-Jan-2009 01:10
18-Jan-2009 02:00
19-Jan-2009 02:30
19-Jan-2009 03:00
20-Jan-2009
21-Jan-2009 01:00
22-Jan-2009 01:30
23-Jan-2009 02:00
I got the function:
=SUM($B$1:$B$13)-SUMIF($A$1:$A$13, "<="& (A1- 7), $B$1:$B$13) - SUMIF($A$1:$A$13, ">"& (A1), $B$1:$B$13)
This was based on Sum of named ranges conditional to date?.
The idea is to first compute the total sum: SUM($B$1:$B$13)
then subtract any values that happened older than 7 days ago: SUMIF($A$1:$A$13, "<="& (A1- 7), $B$1:$B$13)
then subtract any values that happened in the future: SUMIF($A$1:$A$13, ">"& (A1), $B$1:$B$13)
The point is to use SUMIF function, which "adds the cells specified by a given criteria."

Resources