Line graph from date ranges with multiple people - excel

I have a list of tasks in Excel. After each task there is a start date, end date, and # people required to complete the task.
How do I make a line graph that shows how many people we need on any given day, based on the information provided?
(For some reason, this site won't allow me to upload a table or image, but my data is below)
Task / Start Date / End Date / # People
A / 5-11-15 / 5-15-15 / 1
B / 5-14-14 / 5-25-15 / 3
C / 5-15-15 / 5-20-15 / 2
D / 5-18-15 / 5-22-15 / 1
E / 5-20-15 / 5-27-15 / 2
I found a previous post that is similar, but it only uses the COUNTIFS formula - I believe I need to multiply then count. See Line graph from date ranges

In the screenshot below, the formula in cell G2 (pasted into the entire range G2:K18) is
=SUMIFS($D$2:$D$6,$B$2:$B$6,"<="&$F2,$C$2:$C$6,">="&$F2,$A$2:$A$6,"="&G$1)
L2 is simply =SUM(G2:K2)
I would make a stacked column chart using F1:K18.

Related

How can I extract a total count or sum of agents who made their first sale in a specified month?

I am trying to extract some data out of a large table of data in Excel. The table consists of the month, the agent's name, and either a 1 if they made a sale or a 0 if they did not.
What I would like to do is plug in a Month value into one cell, then have it spit out a count of how many agents made their first sale that month.
Sample Data and Input Output area
I found success by creating a secondary table for processing a minif and matching to agent name, then countif in that table's data how many sales months matched the input month. However I would like to not have a secondary table and do this all in one go.
=IF(MINIFS(E2ERawData[Date Group],E2ERawData[Agent],'Processed Data'!B4,E2ERawData[E2E Participation],1)=0,"No Sales",MINIFS(E2ERawData[Date Group],E2ERawData[Agent],'Processed Data'!B4,E2ERawData[E2E Participation],1))
=COUNTIFS(ProcessedData[Month of First E2E Sale],H4)
Formula in column F is:
=MAX(0;COUNTIFS($A$2:$A$8;E3;$C$2:$C$8;1)-SUM(COUNTIFS($A$2:$A$8;"<"&E3;$C$2:$C$8;1;$B$2:$B$8;IF($A$2:$A$8=E3;$B$2:$B$8))))
This is how it works (we'll use 01/03/2022 as example)
COUNTIFS($A$2:$A$8;E3;$C$2:$C$8;1) This counts how many 1 there are for the proper month (in our example this part will return 2)
COUNTIFS($A$2:$A$8;"<"&E3;$C$2:$C$8;1;$B$2:$B$8;SI($A$2:$A$8=E3;$B$2:$B$8)) will count how many 1 you got in previous months of the same agents (in our example, it will return 1)
Result from step 2, because it's an array formula, we sum up using SUM() (in our example, this return 1)
We do result from step 1 minus result from step 3 (so we get 1)
Finally, everything is inside a MAX function to avoid negative results (February would return -1 because there were no sales at all and agent B did a sale on January, so it would return -1. To avoid this, we force Excel to show biggest value between 0 and our calculation)
NOTE: Because it's an array formula, depending on your Excel version maybe you must introduce pressing CTRL+ENTER+SHIFT
If one has got access to the newest functions:
=LET(X,UNIQUE(C3:C9),VSTACK({"Month","Total of First time sales"},HSTACK(X,BYROW(X,LAMBDA(a,SUM((C3:C9=a)*(MINIFS(C3:C9,D3:D9,D3:D9,E3:E9,1)=C3:C9)))))))

Excel: Complex Lookup + 'If Cell Contains'

Example of sheet 1
Where I have repeated entries for the employee. Most employees will have two different shift types but some might have one. The profile contains days of the week and each day of the week is unique to one profile (i.e. no overlapping days between profiles).
employee_name / shift_type / profile
mr_a / type_a / Saturday_Sunday
mr_a / type_b / Monday_Tuesday_Wednesday
mr_a / type_b / Thursday_Friday
mrs_b / type_a / Sunday_Monday_Tuesday
mrs_b / type_b / Wednesday_Thursday_Friday
Example of sheet 2
Where I have a log of each employee, the shift type and the specific day of the week.
employee_name / shift_type / day_of_week
mr_a / type_a / Saturday
mr_a / type_b / Wednesday
mr_a / type_b / Friday
Desired Results:
What I would like to do is successfully match the records from sheet 2 against sheet 1. I want to do is match the profile where:- match employee_name and shift_type are on an 'exact' basis and the profile returned matches the day_of_the_week on a non-exact basis (only a partial match based on the part of the string)
Like so:
employee_name / shift_type / day_of_week / matching_profile
mr_a / type_a / Saturday / Saturday_Sunday
mr_a / type_b / Wednesday / Monday_Tuesday_Wednesday
mr_a / type_b / Friday / Thursday_Friday
What I have tried:
I have tried using array formulae and have been able to solve both halves of the problem. I can get the multiple-matching conditions using multiple lookup criteria in an index_match. However, I don't know how to then combine that to find the match where the cell contains part of the text (i.e. the weekday).
Something like this (but which isn't working):
=INDEX('sheet1'!profile,MATCH(1, (employee_name='sheet1'!A:A) * (shift_type*'sheet1'!B:B) * (TRUE,ISNUMBER(SEARCH(day_of_week,'sheet1'!profile),0))
Thank you for any help!
Try this one, it's an array formula, so enter with CNTRL + SHIFT + ENTER:
{=OFFSET(Sheet1!$C$1,(MATCH(1,--(Sheet1!A:A=Sheet2!A3)*(Sheet1!B:B=Sheet2!B3)*NOT(ISERROR(SEARCH(Sheet2!C3,Sheet1!C:C))),0))-1,0)}
I'll explain this from the inside out, it makes more sense that way:
(Sheet1!A:A=Sheet2!A3)*(Sheet1!B:B=Sheet2!B3)*NOT(ISERROR(SEARCH(Sheet2!C3,Sheet1!C:C)) is your logical test, it's checking whether B2 is found in Sheet1 B:B and returning 1 where it is and 0 where it isn't. Same thing with A2 and A:A. NOT(ISERROR(SEARCH(Sheet2!C2,Sheet1!C:C))) is checking each cell in C:C to see if it contains a partial match of the text in C2. This returns an array of 0's and 1's.
MATCH(1,(array from above),0) tells you where in the array the first 1 occurs. It returns a single number.
OFFSET(Sheet1!$C$1,(Number from above)-1,0) takes the value from Sheet1, column C, and uses the number from above to find the row.
This formula will return the "Weekday_Weekday_Weekday" in column C if there is a match, and #N/A if there is not. If C2 is left blank it will return the "Weekday_Weekday_Weekday" anyways (error only occurs if weekday doesn't match).
Here is a solution I was able to leverage using Wildcards. As a caveat for anybody using this, be mindful that this is basically doing partial matches. However, given that the employee_name and shift_type in my example are unique identifiers, this didn't bother me. This would be an issue for anybody who is matching values which might be sub-strings.
=INDEX(sheet_1!C:C,MATCH("*"&sheet_1!A2&"*"&"*"&Sheet1!B2&"*"&"*"&Sheet1!C2&"*",sheet_1!B:B&sheet_1!D:D&sheet_1!C:C,0))

How can I search and extract in between slash in Excel formula?

I have a list of rows in excel as below.
Australia Order / 111233 -12213AUS / AUD900 / Ready to dispatched
UnitedKingdom Order / 187633 -123413UK / USD 800 / goods
1133 -1013AUS/Australia Order / AUD450 / Ready to dispatched
Australia Order /AUD900 / Ready to dispatched / 1873 -1726A
How can I search "-" and extract the value into a new column? Some of the "-' number are not in sequence after the slash.
Expected result:
111233 -12213AUS
187633 -123413UK
1133 -1013AUS
1873 -1726A
There is quite a bit of string manipulation involved, but I guess you can try this:
=TRIM(MID(LEFT(A2,IFERROR(FIND("/",A2,FIND("-",A2))-1,LEN(A2))),IFERROR(FIND("#",SUBSTITUTE(A2,"/","#",LEN(LEFT(A2,IFERROR(FIND("/",A2,FIND("-",A2))-1,LEN(A2))))-LEN(SUBSTITUTE(LEFT(A2,IFERROR(FIND("/",A2,FIND("-",A2))-1,LEN(A2))),"/",""))))+1,1),LEN(A2)))
The formula basically locates the position of the - and gets the position of the previous and next / relative to that of the -.
Alternatively you could use text to columns and use a lookup with a wildcard:
This will work in your case:
=TRIM(RIGHT(SUBSTITUTE(LEFT(A1,FIND("/",A1&"/",FIND("-",A1))-1),"/",REPT(" ",99)),99))
Find index "/" after "-" in string -> extract text from begin to this index
Get last word from this string
Hope it helps!

Excel - Filtering for multiple dates / #s within one cell

I have downloaded a data table from a sharepoint list website into a excel file and have filtered for the keyword 'Contract' which narrowed down my results from 1000 rows to approx 180 rows.
I am tasked with determining the # of contractors Between date X and Y.
The filters I would normally use are:
Employment Type = Contract
Contract Start Date >= 10/01/2017
contract End Date <= 05/31/2018
The issue I am having is all this data is contained within 1 cell and there are two variations of spelling for 'Contract' (Contract and Contact).. so I also have to factor this is.
Here is a small snippet from 1 of the cells:
"Position":"Account Services Agent","Manager Name":"xxxx","Manager Phone":"43524325","Employment Type":"Contract","Contact Start Date":"01/08/2018","Contact End Date":"03/30/2018","Beeline Request ID number":"67160"},{"ID":"1111","Name":"xxxx ","Position":"Account Services Agent","Manager Name":"xxxx ","Manager Phone":"4444444","Employment Type":"Contract","Contact Start Date":"01/08/2018","Contact End Date":"03/30/2018","Beeline Request ID number":"67160"},{"ID":"333333","Name":"xxxx ","Position":"Account Services Agent","Manager Name":"xxxxx ","Manager Phone":"44444","Employment Type":"Contract","Contact Start Date":"01/08/2018","Contact End Date":"03/30/2018"
I need to somehow determine how many contractors there are that meet my date range criteria
Any ideas/solutions would be greatly appreciated.

PivotTable - Calculate value depending on combination of row labels

WARNING - Using Excel 2011 for Macs, inexperienced user
Hi All,
I have a sheet in Excel with a bunch of categorical fields and some numerical ones as well. Let's say it looks like the following:
I would like to make a pivot table that will display the average click rate (avg_click_rate) of the unique combinations of [year, region], i.e. the combinations of fields in the pivottable's rows section.
For example, the avg_click_rate of [years=5] is:
(0.5*10)/(10 +5 ) + (0.6*5)/(10+5) = 0.53
while the avg_click_rate of [region=north] is:
(0.6*5)/(5+20) + (0.2*20)/(5+20) = 0.28
and the avg_click_rate of [years=5, region=south] is:
(0.5*10)/10 = 0.5
I know I have to make a custom Calculated Field to do this, but for the life of me I cannot figure out how to code the formula. Any help would be seriously, seriously appreciated.
To be clear, my formula would be:
SUM{ (click_rate * number_members) / SUM{number_members} }
where the numerator is a single value for each row included in the unique combination of [year, region], while the denominator is a constant - the total number_members for the unique combination of [year, region].
You should create a new column in your source table:
product = click_rate * number_members
And then create a Calculated Field in the pivot table:
CF = product / number_members
Using AVERAGEIFS:
AVERAGEIFS($C$2:$C$9,$A$2:$A$9,A2,$B$2:$B$9,B2)
EDIT:
You can add up to 127 conditions, see: AVERAGEIFS function
Criteria_range1, criteria_range2, … are 1 to 127 ranges in which
to evaluate the associated criteria.

Resources