How to Perform Column-Wise Logical Operations in Excel - excel

I'm working with an Excel sheet of customers, a snippet of which looks like this:
Name
Month
Contacted?
Bob
January
Yes
Sally
January
Yes
Smith
January
No
Alice
March
No
Peter
May
Yes
I'm trying to get a count of the customers in each month that have been contacted and those in each month that haven't been contacted. I've been able to get a count of the number of customers in each month by doing =SUMPRODUCT(B2:B5="January") and a count of how many customers have been contacted with =SUMPRODUCT(C2:C5="Yes"). It feels like there should be a way to perform column-wise logical operation, like this: =SUMPRODUCT(AND(B2:B5="January", C2:C5="Yes")) to get a count of the number of customers that were contacted in January, but that doesn't work.
The end table that I'm trying to generate would look like this, where any edits to the above table should update this one:
Month
Total Customers
Contacted Customers
Non-Contacted Customers
January
3
2
1
March
1
0
1
May
1
1
0
What's the right way to implement these formulas?

Where your Data is in Column A to C and your Table Starts at Column E

Related

Sum product for all the months if 2 tables match

So I have this issue, I have two tables one is employees, and another one is the projects.
Employees Table:
Year Name Type Jan Feb
2018 Kevin Salary 5000 2000
2018 Kevin Insurance 200 400
2018 Alex Salary 3000 4000
2018 Alex Insurance 300 400
Projects Table
Year Project_Name Employee_Name Jan_Hours_Worked Feb_Hours_Worked
2018 Apple Alex 7 5
2018 Apple Kevin 5 0
2018 LG Kevin 0 3
Now I am creating a result list of all the projects and costs recurred for them, what I need is for each project in Table 2 to find which employees are involved and then use that to find related costs for the employee from the Table 1 and calculate total costs for that project.
(e.g for project LG, I have Kevin working on that in Feb,for him company paid 4400(salary+insurance) in Feb and the costs recurred for the LG project would be 4400 divided by hours spent on the project which Kevin in total spent 3 hours; e.g.2 for the project Apple it would be the same but sum of Kevin's and Alex's costs from Jan and Feb, so Kevin: 5200/5 + Alex:3300/7 + 4400/5)
Now I have the formula to calculate this for 1 months which is something like this
=SUMPRODUCT(SUMIFS(Employees[Jan], Employees[Name],Project[Employee_Name], Employees[Year], 2018 )/Project[Jan_Hours_Worked],--(Project[Project_Name]=K14))
I need to find how to get the yearly result per project without repeating the formula 12 times, also with this formula, i get div to 0 error when an employee didn't work on particular months, so that needs to be sorted somehow. Any Help?
I suggest you to change how you store your data. If you can make some minor changes, then you can have an easy way to get the information you want, and also a Pivot Table with a summary of cost recurred for each proyect and which employee generated that cost.
IMPORTANT: For this answer to work, you must make sure that every Employee's Name is UNIQUE. If not, adapt the example trying to create
an Employee's ID or something.
Also, please, note i got a spanish version of Excel, so screenshots are in spanish but I will translate formulas :)
Ok, first of all, I changed the design of your table Employees. Creating a column for each month is kind of annoying. Use just a column to get the month. You can type the month in a cell just like 01/2018 and Excel will change it instantly to format mmm-yy (Jan-18)
This is how your Employees table should look:
The column TOTAL COST is just a sum of SALARY + INSURANCE. If you have any other concept, just add it as a column and modify the TOTAL COST COLUMN to include it.
Second, the table Project, I think it should be like this:
The column Employee Cost has an Array Formula.
IMPORTANT: Array formulas are inserted pressing CTRL+SHIFT+ENTER
The formula is (I used same names for tables, so copy-pasting should work for you):
=INDEX(Employees;MATCH(Project[[#This row];[Employee_Name]]&Project[[#This row];[Month]];Employees[Name]&Employees[Month];0);COLUMN(Employees[[#Headers];[TOTAL COST]]))
If you typed the formula right, you should see { at start and } at end.
The formula in Cost Recurred to Project is just a division of Employee Cost / Hours. Added an IFERROR when the hours worked are 0, then show 0.
=IFERROR(Project[[#This row];[Employee Cost]]/Project[[#This row];[Hours]];0)
And last step, your Pivot Table. Create one and organise it to get the sum per hours and month and proyect you want. You can get one like the one below:
As you can see,e.g. for project Apple, you can see that total cost is 2.391,43
but also you can see the cost of each Employee. Pretty cool I think.
I really hope you can modify the design of your data, because Excel is designed to work going down (I mean using rows) more than using columns. Excel 2007 got more than 1 million of rows and just around 16.000 columns, so it's designed to work vertically.
Hope this helps, or at least, give to you a clue of how to proceed :)

CountIfs with Multiple Criteria?

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)))

Count Unique Entries in a Month for Pivot Table

Good afternoon,
I'm currently working on setting up a pivot table for chart that outlines an Average Revenue per Person by Line Type. Using the pivot table, I can sort everything out, but when I try to get a count of person, it adds all instances of that person's name up. What I want is that if the person's name appears once in a month, all other instances in that month of the person's name are not counted. But during a new month, the person's name will appear once more. So, it is somewhat like a unique count, but only unique per month.
My excel table looks something like:
A B C D
Date Person Revenue Line Type
1/1/2015 John $100 Toy
1/6/2015 Phil $200 Toy
1/6/2015 Jane $25 Garden
1/7/2015 John $50 Electronics
1/25/2015 John $10 Electronics
2/1/2015 John $10 Toy
2/17/2015 Phil $30 Garden
2/20/2015 Bob $500 Electronics
2/21/2015 Jane $100 Garden
So, as you can see, a person's name can occur more than one time in a month, and in more than one month. Currently, the code I am using for my helper column (E) is:
=1/COUNTIF($B:$B,B2)
This has only been giving me a count of patients throughout the entire year, not taking new months into account. I also have attempted this formula:
=IF(SUMPRODUCT(($B$2:$B2=B2)*($A$2:$A2=A2))>1,0,1
This only counts values that occur on the same day. I've tried adding in MONTH() checks and such, and am only getting syntax errors. I'm not sure where to turn for this one. Thank you!
Thanks to #TomSharpe's advice, I added a helper column to concatenate Month/Date and the Patient's name like so:
=MONTH(A2)&"-"&B2
Then used the original formula (below) to COUNTIF divided by 1.
=1/COUNTIF($B:$B,B2)
This gave me exactly what I needed.
Thanks again!

select data of one column on basis on another column in excel

I am trying to create an excel sheet in which I have one column which stores the date of a software release and just right to it is stored whether that release rejected in the form of yes or no. something like this:
Release Date Rejected
25/01/2015 No
26/02/2015 No
30/03/2015 No
01/05/2015 Yes
With this I am maintaining another table in same sheet which gives total number of releases and rejected releases till a particular month something like this:
Year = 2015 No. of release No of rejected release
Month Till month IN month Till month IN month
January 1 1
February 2 1
March 3 1
April 3 0
May 4 1
If you see in result table, no of release till MAY are 4 and in the month of may it is only one. This I am doing by comparing all dates in "release date" column with 31/05/2015 and counting all dates before that.
Similarly I want to do for number of rejected release. for example for month of May, count all release dates before 31/05/2015 and then from that count only those release which are rejected on basis of yes or no.
Can anyone please help as I am not able to figure out the formula for this.

Excel Pivot Table - Averaging by Category

I'm trying to create an average by category in a pivot table. This is the first time I've created a pivot table so sorry if the answer is staring me in the face. My raw data looks like:
Date, Transaction type, Description, Paid out, Paid in, Balance, Category
Mar-13, Visa, SHOP, £4.44, , £X, Gifts
Mar-13, Visa, SHOP, £5.00, , £Y, Children
Mar-13, Visa, SHOP, £6.00, , £Z, Gifts
Mar-13, Visa, CLOTHES SHOP YORK, £8.00, , £A, Clothing
Mar-13, Visa, FOOD SHOP, £11.96, , £B, Food
My pivot table shows the information rolled up by Month and grouped by a category:
Row Labels Sum of Paid out Sum of Paid in Sum of Difference
2013
Jan £Jan £Jan £C
Food 1 2 -
Car 2 3 -
Cash 6 6
Feb £Feb £Feb £D
Food 1 2
Car 8 0
Cash 2 3
The categories/data is made up in this case, but the desired outcome I'm after is to get an annual average, informing me how much comes in/out on average across the year per category... looking something like:
Row Labels Sum of Paid out Sum of Paid in Sum of Difference
2013
Avg £AvgIn £AvgOut £AvgDiff
Food 1 2 -
Car 5 1.5 -
Cash 4 4.5
Jan £Jan £Jan £C
Food 1 2 -
Car 2 3 -
Cash 6 6
Feb £Feb £Feb £D
Food 1 2
Car 8 0
Cash 2 3
Is this possible to achieve using a pivot table, as I can't seem to find a way to this at the moment using Excel 2010.
Since it appears that your raw data is already grouped by month, you're able to do this pretty easily. You need to re-arrange your data, however -- the months and the categories need to be on different axes. For example, Category as ColumnLabels, with Values then Month as Row Labels. Then right-click one of the normal values for Paid Out, choose "Summarize Value As...", you'll see SUM is currently checked, just change to AVERAGE. Repeat for one of the Paid In values. The labels should change to help let you know if it worked.
Note that this will NOT work effectively if your source data comes in daily, for example. With only one entry per month, the SUM and the AVERAGE of the single entry are identical. This would not be the case if your raw data was daily (and you still grouped by month) -- you'd be switching from a monthly total to a daily average.
I am currently using LibreOffice, which is just the free version of Excel on a mac. It is basically the same thing, but anyways, do you see the top bar where it says =AVERAGE(B8,C8,D8)? Well, that is how you can incorporate the functions within the table. This is actually a pivot table I had to do for my Java class. All you have to do is click on the cell you want to edit, type =, the function name, (in your case, AVERAGE should be fine) and then any other kinds of functions you use. Hope this helps you out.

Resources