CountIfs with Multiple Criteria? - excel-formula

I have a table like this:
Date Paid Days Late Date Paid Days Late Date Paid Days Late Date Paid Days Late Date Paid Days Late Date Paid Days Late
Utilities Admin Utilities Admin Utilities Admin
Company January January January January February February February February March March March March
Wayne Enterprises 2/15/2016 5 10-Feb 0 3/11/2016 1 4/15/2016 5 4/25/2016 15
Stark Industries 2/12/2016 3 2/8/2016 0 3/19/2016 10 3/8/2016 0 4/15/2016 5 4/1/2016 0
(I suggest though looking at the screenshot to see how it's laid out, as the pasting into here isn't very pretty, any tips? Here's a link to this on Google Spreadsheets).
How can I, in N4, create a formula that will count the number of months what have a late report (defined as any "Days Late" over 0). Obviously, I can do this:
=COUNTIFS(B1:M1,"Days Late",B4:M4,">0"), which returns 4.
For Wayne Enterprises, in March, both Utilities and Admin were paid late. However, this should only count as 1 month. How can I somehow add to my CountIfs() a statement that is like "if two values in the same month are greater than 0, treat as ONE month"?
I tried also doing something like:
=COUNTIFS(B1:M1,"Days Late",B4:M4,">0")/COUNTIFS(B1:M1,"Days Late",B4:M4,">0")+1
But that doesn't quite do the trick either. Thanks for any ideas. (Of course, if CountIfs() isn't the best way, I'm open to any other formulas! I have a sneaking suspicion SumProduct() might be an alternative) I'd prefer a formula solution over VBA, but if absolutely necessary, we can do a UDF perhaps.
Edit: I could create yet another helper column that compares a single month's Utilities and Admin, and if one or both are late, put 1, then just Countif() that column has 1 in it...but I'd rather not keep creating columns if I can help it, as I'll be doing this for 12 months.

Use this Array formula:
=SUM(IF(($B4:$M4>0)*($B$1:$M$1="Days Late"),1/COUNTIFS($B$3:$M$3,$B$3:$M$3,$B4:$M4,">0",$B$1:$M$1,"Days Late")))
Being an array formula it must be confirmed with Ctrl-Shift-Enter when exiting edit mode. If done properly excel will put {} around the formula.
As per your new data use this:
=SUM(IF(($B5:$BI5>0)*($B$1:$BI$1="Days past 10th of Following Month"),1/COUNTIFS($B$3:$BI$3,$B$3:$BI$3,$B5:$BI5,">0",$B$1:$BI$1,"Days past 10th of Following Month")))
The helper row of months in row 4 is not needed.
EDIT #2
My bad I forgot that when using formulas that return "" will cause an error so lets put in a check for that:
=SUM(IF(($B5:$BI5<>"")*($B5:$BI5>0)*($B$1:$BI$1=$AS$1),1/COUNTIFS($B$3:$BI$3,$B$3:$BI$3,$B5:$BI5,">0",$B$1:$BI$1,$AS$1)))

Related

Excel - SUMIF Function

I made a worksheet covering meal expenses for a set period of time (01-08-2020 until 31-08-2020.)
The company will pay up to 75kr, Monday-Friday.
The list covers expenses 7 days a week, If the amount is greater than 75 on Monday-Friday, I have to pay the extra expenses. (This I have figured out correctly). Saturday and Sunday I have to pay fully.
So my question is, how can I sum this and exclude Saturday and Sunday?
Attempt 1:
I tried this formula (Norwegian excel. Summerhvis = SUMIF. Lørdag = Saturday):
=SUMMERHVIS(B2:B32,"<>lørdag", G2:G32)
It seems to be partly correct however, I miss Sunday, how can I add Sunday to this equation?
Attempt 2:
I used this formula:
=SUMMERHVIS(B2:B32,B2:B6,G2:G32)
It gave the correct answer but the answer was layered in 5 rows. I then summed this in P8.
Where I want the answer is in G32. So in G32 I wrote =p8.
It must be an easier way of doing this?
You can use SUMPRODUCT and the WEEKDAY function:
=SUMPRODUCT((WEEKDAY(A2:A32,3)<5)*G2:G32)
According to the Microsoft function translator, this might be, in Norwegian:
=SUMMERPRODUKT((UKEDAG(A2:A32;3)<5)*G2:G32)
If you really want to use SUMIF and your text days, one way would be (in English):
=SUM(SUMIF(B2:B32,{"Monday";"Tuesday";"Wednesday";"Thursday";"Friday"},G2:G32)),
or, if your weekday days are in b4:b8:
=SUM(SUMIF(B2:B32,$B$4:$B$8,G2:G32))
but I'd advise against it as it would only work in the language of the text days of the week. Also, I note your days of the week don't seem to match up with what the days of the week were in the US. For example, here 1 Aug 2020 was a Saturday, so another possible cause for error (unless I am not understanding the dates correctly).
The above is the same as summing five separate SUMIF equations, each for a desired day of the week.

How to display reports between two different dates on a monthly basis?

The problem that I'm facing currently is I have a start date and end date for multiple different items. What I want to do is be able to see when a report would be due at each given month that it's accounted for with a end report (+14 days from end date). For example:
The Lookup tab that I have for reference of the dates above to be able to match the months looks like this:
Now I'm having trouble creating a formula that would actually work with this. If I'm thinking correctly it would be something like,
IF Start Date != Start Month then IF Start Date is between March Dates, "Report", . . . IF End Date hits, add 14 days, then "End Report" on given month after 14 days.
So for the example above the outcome would look like the following:
This is the end result that I would want in the end. Due note that August for Battlefield 5 is supposed to be blank due to the game ending on 8/19/2018, +14 days for a end report: 9/2/2018 is the End Report date so their would not be a Report in August for that given scenario. (I think this is possible but not 100% sure for the August scenario)
I am open to any kind of formulas/Arrays/VBA's that would accomplish this task. I'm just having difficulty coming up with a solution for this that has been bugging me for a while, so any help is much appreciated!!
If anything needs to be further explained please let me know and I will do my best as an edit to this post.
-Maykid
Based on what you explained, you could just have a simple formula as such (no need for VBA):
LOCALISATION OF THIS FORMULA (E2) UNDER FEBRUARY 2018 in the picture attached
=IF(AND(MONTH($C2)=MONTH(E$1),MONTH($C2+14)=MONTH(F$1)),"",IF(AND(MONTH($C2+14)=MONTH(E$1),YEAR($C2+14)=YEAR(E$1)),"End Report",IF(AND($B2<E$1,($C2+14)>E$1),"Report","")))
And then you can drag this formula.
I hope it helps.
BR

Another formula request

This time I would like help creating a formula that calculates a payment every 28 days (28 days, continuously, not 28 day of month).
Here's an example of how I intend to use the formula:
I have online newspaper access and I am billed to my credit card every 28 days. I am next due for billing at 9 February 2017.
So I want to write a formula that will calculate the result of =(5*4), every 28 days, starting from 9 February 2017. Otherwise, show $0.00 (eg 0*0).
As always, I appreciate any assistance.
Thank you.
Matthew
If you are simply dragging the formula down, you can use the following formula assuming your start date 9/2/2017 is in A1:
=IF(MOD(ROW(A1),28)=ROW($A$1),5*4,0)

EXCEL FORMULA FOR DATES

I just want to ask an excel formula for this.
If an employee exceeds one year of employment he will have a free uniform
If he was hired last October 1, 2015 and he requests for new uniform this October 22, 2016 then he should have free uniform.
10/1/2015 - 10/22/2016 = "Can Avail Free Uniform" or "Cannot Avail!"
I just want the two optional answers to reflect using an excel formula.
Thanks
If I would create a formula like this:
I would use 4 cell columns:
Date Hired,Date Request,Years of Service,isAvail
On my Years of Service, I would use DateDif Function,
Where =(DateDif('cella','cellb',"m")/12) in order to achieve a year.
Then on isAvail column, I will use =IIF('cellc >= 1', "Can Avail","Cannot Avail")
See if it helps.
I would use these four columns
and use the following formula in D2:
=IF(AND((C2-A2)/365>=1,(C2-B2)/365>=1),"Can avail free uniform","Cannot avail")
This checks to see of the time since date of hire AND the time since the previous request is more than 1 year and returns "Can avail free uniform" if both equals ore are greater than 1, and returns "Cannot avail" if one of them is less than 1.

Tallying dates and times in excel

Is there an easy way to tally a column formatted as follows: "5/24/2013 5:48:00 PM"
What I want to do is have it tally by day of week and an hour time block, the end result I'm looking for would look like the following:
Sunday Monday Tuesday Wednesday Thursday Friday Saturday
1:00-2:00AM 10 2 8 7 3 12 15
2:00-3:00AM 5 4 7 7 9 11 18
et cetera. This is an extremely large data set so avoiding doing this by hand would be amazing. I apologize if this is a terrible question, I tried searching though other people's questions to no avail.
Not knowing the details, I would try to use a PivotTable.
There is the ability to group by dates; see this page for details (including a fancy animation).
Some additional searching should turn up a lot of resources on PivotTables; they are very powerful.
I'd assign a number to the rows/columns and then use sumif().
I would create add two columns: one with =Hour(A2), other with =WeekDay(A2) (example for row 2, assuming dates are on column A).
Then, use PivotTable on all data.
Regard formats: WeekDay must be formated as ddd or dddd and Hour as numeric.

Resources