Background:
This excel is to track the hours someone works and what days. It also needs to track the total days worked in a week.
Requirement:
The 'Total Days' column needs to count the Monday(M) to Sunday (S) columns if they are greater than 0
Previously I had a simple COUNTIF(H6:K6, ">0") or whatever it was, which worked well.
Now the user has added in extra columns for pay and charge rates each day, after the corresponding day, which has thrown the formula off, and the COUNTIF formula wont do the columns separately inside the same formula.
Snippet of excel layout
Also some clarification, In AZ1 for instance I would want it to count H1, K1, N1, etc up to Z1
If anyone could help me work out a formula, that would be great!
COUNTIFS uses AND logic, whereas, you need OR logic. Try something like:
=COUNTIF(A3,">0") + COUNTIF(B3,">0")+...
EDIT: Since that didn't work, this should do the trick:
=COUNTIF(H5,">0")+COUNTIF(K5,">0")+COUNTIF(N5,">0")+COUNTIF(Q5,">0")+COUNTIF(T5,">0")+COUNTIF(W5,">0")+COUNTIF(Z5,">0")
Try using the MOD function to determine the stagger of the columns. SUMPRODUCT and ISNUMBER can take care of the rest.
=SUMPRODUCT(NOT(MOD(COLUMN(H:Z)-8, 3))*ISNUMBER(H6:Z6))
Related
After years of using this community, I have a question that I can't find an answer to. I hope you all can help!
I am trying to get a count of the number of "Grounded" items that each individual is overdue for. My screenshot (Count Tracker) shows a very condensed version of what I'm working with. Columns A-C is my large (15,000 rows) data field that is imported from an external source. In columns G-H I have listed each possible task (about 100 rows) and the type (Grounded and Non-Grounding plus many others). Column F is where I am trying to get the count.
My formula in F9 currently uses COUNTIFS to get a count of the instances in the large array that equal E9 ("Smith" in this case) and where the due date in the large array is less than or equal to the current date in F8. What I can't figure out is how to also add to count the Tasks in the large array where the task type in Column H equals "Grounded". I tried VLOOKUP, but it seems it doesn't like it and tells me there is a problem with the formula. It doesn't work, but here's the general idea of what I'm after:
=COUNTIFS($A$2:$A$7,$E9,$C$2:$C$7,"<="&$F$8,VLOOKUP($B$2:$B$7,$G$2:$H$4,2,FALSE),"=Grounded")
With how the data is currently presented, Smith should have a count of 1 and Jones should have a count of 0. I have a feeling that this is more simple than I'm making it to be, but I can't figure it out. I am using Excel 2016.
Hopefully I explained the problem well enough. Thank you for your assistance.
With Excel 2016 I'd say MMULT() is a good alternative here:
CSE-Formula in F9:
=SUM((A$2:A$7=E9)*(MMULT((TRANSPOSE(G$2:G$4)=B$2:B$7)*(TRANSPOSE(H$2:H$4)="Grounding"),ROW(G$2:G$4)^0))*(C$2:C$7<=F$8))
You could add a fourth column that stores whether that Task is Grounded
The formula for D2 would then be:
=INDEX($H$2:$H$4,MATCH(B2,$G$2:$G$4,0))
Modify your CountIfs formula to use this new column as a criteria
=COUNTIFS($A$2:$A$7,$E9,$C$2:$C$7,"<="&$F$8,$D$2:$D$7, "Grounded")
Try this Sumproduct+Vlookup formula without helper solution, and can work for your Excel 2016
In F9, formula copied down :
=SUMPRODUCT((A$2:A$7=E9)*(VLOOKUP(T(IF({1},$B$2:$B$7)),G$2:H$4,2,0)="Grounded")*($C$2:$C$7<=$F$8))
I want to count the times John was in the blue room and it was a thursday. I played with COUNTIFS and WEEKDAY and checked the documentation.
I tried COUNTIFS with two conditions but got errors or 0 as a result.
As #Gary'sStudent said with the column with the day already in place you do not need the WEEKDAY a simple COUNTIFS will work:
=COUNTIFS(B:B,"Thursday",C:C,"John")
If you did not have that column then you would need to revert to the SUMPRODUCT() formula similar to what #Gary'sStudent has:
=SUMPRODUCT((WEEKDAY(A4:A17)="Thursday")*(C4:C17="John"))
Both formulas will work, the main difference is that the COUTNIFS() is not an array formula, and therefore you are able to use full column references without detriment. The SUMPRODUCT, to minimize calc times, one would need to reference only the dataset.
Consider:
=SUMPRODUCT(--(B4:B17="Thursday")*(C4:C17="John"))
You do not need WEEKDAY() because you have a column that specifically defines each day.
I´ve spent a lot of time with a formula in Excel and I´m still blocked. I hope you can help me.
I have a table in Excel with several values as shown in this
screenshot.
What I´m trying to extract is the number of Fruits sold in a specific month. That is, how many lemons were sold in January 2016, for example. This is the formula I´m using:
=SUMPRODUCT((B3:B38=E4)*(MONTH($A$3:$A$150)=12)*(YEAR($A$3:$A$150)=2015);$C$3:$C$150)
But the result is #N/A as seen in the screenshot.
What Am I doing wrong? Any help, please?
Thanks a lot in advance!
You can use arrays in excel to get this answer
{SUM(IF(MONTH(F$3&"1")=MONTH($A$3:$A$150),IF($E4=$B$3:$B$150,$C$3:$C$150,0),0))}
You can use this Sumproduct formula which uses array logic:
SUMPRODUCT((MONTH($A$3:$A$38)=MONTH(TEXT(G$2,"MMM")&1))*($C$3:$C$38=$F4)*
($D$3:$D$38))
Sumproduct Demo
Part of your problem is your ranges are not equal in length. B3:B38 has to be the same number of rows as $A$3:$A$150 and C3:C150. When rows are not equal things blow up on you.
=SUMPRODUCT(($B$3:$B$150=$E4)*(MONTH($A$3:$A$150)=12)*(YEAR($A$3:$A$150)=2015);$C$3:$C$150)
if you change your header row to be actual excel date format, and then change the cell display format to just show the month (as suggested by csanjose), then you can adjust your sumproduct formula as follows and copy to all cells in your table.
=SUMPRODUCT(($B$3:$B$38=$E4)*(MONTH($A$3:$A$150)=Month(F$3))*(YEAR($A$3:$A$150)=Year(F$3));$C$3:$C$150)
Fill your month-row with the last day of each month, then apply date format to show only month name.
The formula you should use is, for example, in g8:
=SUMIFS($C:$C;$B:$B;$E8;$A:$A;"<="&G$3;$A:$A;">"&F$3)
First column "F" doesn't have a column on the left to compare, so you can put a date in E3 or change a bit the formula (example of F8):
=SUMIFS($C:$C;$B:$B;$E8;$A:$A;"<="&F$3;$A:$A;">2015/12/31")
Take a look at the result
If you don't want to use a pivot table, you can use this formula to get what you need:
=SUMPRODUCT(($B$3:$B$150=$E3)*(MONTH($A$3:$A$150)=1)*(YEAR($A$3:$A$150)=2015)*$C$3:$C$150)
Then drag-fill the cell to copy it to every month column (just make sure you change the month number in the formula (and year if you're doing that too)), and then drag-fill down the columns.
That should work pretty food good :)
Good Luck!
I would need some help again with another excel countif expression. I have the line i2:al2 which contains leftover stock data.I am building a worksheet to calculate remaining stocks in % as per supervisor's wish.
As I am working with %, for example if I say that 90% sales that means we have 103 stock left and with 91% sales I have 100 stock left.
Anyways I got around to count the number of stock left in line i2:a12 using countifs.
Example if I need to calculate leftover stock for sales at 90% which means leftover stock level of 100 to 102. I have used :
=countif(range,">100")-countif(range,">102")
This method seems to work till I reach negative numbers, i.e. oversales. For example, if I try to do the following:
=countif(range,"-100")-countif(range,">0")
the formula seems to stop working. If I count manually using a conditional formatting I get a totally different answer for the oversales.
Maybe I am getting the logic of the countif function wrong. My purpose for the expressison is:
=count(in range, values >=X & <=Y)
As I have only access to excel 2003 I cannot use Countifs method. Anyone could help me on this issue?
Many thanks.
You can use an array formula:
=SUM((range>=x)*(range<=y))
For that to work, you need to press CTRL-SHIFT-ENTER for that to use array formula.
Alternatively, using what simoco gives in the comment works too without having to save as array formula.
I am trying to create spreadsheet to use in a small retail shop.
I have a workbook which contains expenses figures on a sheet and income figure on another sheet.
We can say that the common ground between the both sheets are the month.
I would like to write a function, which will only select those expenses of a specified month.
Something like -
=SUM(IF( Table4[Month]="January", Table4[Amount]))
// I want the sum of all expenses of a given table for only
// those months which are january etc.
I tried using the above, but it failed.
Actually a more refined solution is use the build-in function sumif, this function does exactly what you need, will only sum those expenses of a specified month.
example
=SUMIF(A2:A100,"=January",B2:B100)
This should work, but there is a little trick. After you enter the formula, you need to hold down Ctrl+Shift while you press Enter. When you do, you'll see that the formula bar has curly-braces around your formula. This is called an array formula.
For example, if the Months are in cells A2:A100 and the amounts are in cells B2:B100, your formula would look like {=SUM(If(A2:A100="January",B2:B100))}. You don't actually type the curly-braces though.
You could also do something like =SUM((A2:A100="January")*B2:B100). You'd still need to use the trick to get it to work correctly.
SUMIF didn't worked for me, had to use SUMIFS.
=SUMIFS(TableAmount,TableMonth,"January")
TableAmount is the table to sum the values, TableMonth the table where we search the condition and January, of course, the condition to meet.
Hope this can help someone!