How to calculate no of days where sales were made in MS excel using sumifs and countifs? - excel

I am working on an excel sheet where I am required to calculate average number of days the stores in a city were able to make some sales. I am attaching a sample of the table for reference. The values in the cells represent the number of units sold(not relevant to this question).
Here across NY, two stores are present, and out of the total number of days in consideration (3*2), only 4 days some sales were made, making the average 66%.
Similarly for Paris, there exists only one store which was open across all days.
To arrive at the figures, I tried using nested countifs and SUMIFS , but did not receive the expected results. Also, in some of the older posts, users had suggested to use INDEX MATCH with SUMIFS, but I was not to get accurate results using these.
Can anyone help me to get the correct figures for Total days, and Days with some sale.

SUMPRODUCT SOLUTION
=SUMPRODUCT(--(A$2:A$5=A8)*--(C$2:E$5<>""))
=SUMPRODUCT(--(A$2:A$5=A8)*--(C$2:E$5<>"NO SALE"))
=ROUND(C8/B8,4)

First, according to your grid NY made sales on 4 of the 6 days. (NY1: Mon, Wed; NY2: Tues, Wed). Thus the average is not 50% but 66%.
Second, to get your formula. Assuming "Place" is in column A. Below is for NY, you can solve for the rest.
Total number of days:
In cell "C9": =COUNTIF(A2:A4,"=NY") * 3
Days with sales:
In cell "D9": =COUNTIF(C2:E2,"<>NO SALE") + COUNTIF(C4:E4,"<>NO SALE")

Related

Excel: Count distinct numerical values if string condition matches

I have a list of employee names on one tab and another tab with orders shipped by employees and the month they were shipped going back 12 months. I'd like to calculate the average number of products shipped per employee per month, but I need to know how many months they were here to do that. So what I'd like to do is essentially write a formula that says give me the count of the distinct number of months they've been shipping products.
Sample employee data:
And here's the sample data on the individual shipments:
So in short, I need to know that Joe Smith shipped those 250 products across 3 distinct months to see he averages 83.3 shipments per month. Again, because there are many new people who have come onboard in the last 12 months, I can't just divide them all by 12 and need to know how many months they were shipping items in.
FILTER Shipper and Month based on Shipper column with criteria Employee name. Apply UNIQUE on filtered array to get only unique values (name + month number). Use COUNT to get active months. Divide Products Shipped by it.
Result:
Average by Count of Uniques
=LET(Shippers,B2:B11,Months,C2:C11,uShippers,E2:E4,uProducts,F2:F4,
uMonths,BYROW(uShippers,LAMBDA(uShipper,
ROWS(UNIQUE(FILTER(Months,Shippers=uShipper))))),
IFERROR(uProducts/uMonths,""))
You can use this array version, which spills all the results at once:
=LET(empl, A2:A4, prods, B2:B4, shipper, B7:B16, months, C7:C16,
ux, MAP(empl, LAMBDA(e, COUNT(UNIQUE(FILTER(months, shipper=e))))), prods/ux)
Here is the output:
It is also possible not using MAP but it is a verbose solution:
=LET(empl, A2:A4, prods, B2:B4, shipper, B7:B16, months, C7:C16,
left, TRANSPOSE(N(shipper=TOROW(empl))), right, N(months=TOROW(UNIQUE(months))),
cnts, N(MMULT(left, right)>0), ux, MMULT(cnts, SEQUENCE(ROWS(cnts),,1,0)), prods/ux)
Replacing TOROW with TRANSPOSE it should work for older Excel versions.
This is how I would have done it, create a Pivot table(Insert->Pivot Table) with Months as column, Employee as row and the values as count of shipments. Once you have the Pivot table, your life becomes easier. Now you do a count of the employee row (COUNT(COL-1:COL-X)) to count the total months a particular employee showed up.You now have count of shipments and a count of months. You can calculate the average. Not sure I can think of anything else easier.

Average using excel formulas

hope it's been a good holiday.
Had a question regarding excel, that can best be phrased through an example.
I have a table which has 4 columns and 2 rows. in the each of the 4 inputs in row 1, we have a $ amount our company has (100000, 150000, 200000, 175000), and in row 2 we have the amount of product which we've been able to purchase, note: this products doesn't have a fixed price, and is constantly changing. Row 2 has the values (10000,20000,22000, 18000 respectively for the above $ amounts).
I want to have a cell, where if I input the dollar amount, I have, it will give me the average amount of product I can buy based on the historical data. Also, I need the formula to be dynamic, i.e once I add a fifth column, it takes the average using 5 datapoints, instead of the previous 4.
Thanks for any help, was having problems uploading an excel to display this, so hope this suffices.
I tried various look up/index formulas with no luck.
You want FORECAST.LINEAR():
=FORECAST.LINEAR(C6,2:2,1:1)

Assign specific dates based to an employee level dataset on weighted averages in excel

I have a dataset in excel which shows headcount by employee level and which department each employee would fall under (sales, ops, or support). I would like to send a survey to each employee once every 26 weeks (2 times a year), but I would also like to keep sending surveys every week to ensure continuation of surveys to a certain amount of population split between sales, ops, and support departments based on their weight of the total population.
This way, I am sending surveys every week to a tiny bit of my overall headcount but only repeating people every 26 weeks.
Can anyone please help on how to solve this in excel with a formula?
From attached sample data, how can I split the headcount to send surverys for 26 weeks straight but to different population every week and not repeat? This different population should be split by % of department out of total headcount. Meaning if I have 10 people every week and % split is 40% sales, 30% operations, and 20% support, the survey should be sent to 4 sales, 3 operations, and 2 support people. Please note that the 10 people and the %s may vary every week because of new hires and resignations.
Thank you!
Sample Data
In the data sheet, ceate a helper column D, where you hand out the numbers to each employee, label it MOD. Use the formula for each employee, enter to cell D2:
=MOD(ROWS(A$2:A2)-1;$H$2)+1
That way each employee is assign a number from 1 to whatever is in the cell H2, e.g. 26. Then contact list all employees with 1 and you have the first batch and so you continue each week to get to employees with 26 in 26 weeks. This way all get the survey but just once.
Of course the share of the individual depts cannot be achieved each time, as there are less employees in some. If you wanted to keeps the shares, some employees of the smaller departments would get the survey more times.
If you want to get some randomness into the order, just mix the order of MOD numbers, e.g. start with 7, continue with 23 etc.
I hope I got the question right, I am not sure in some parts.

Determining how many entries were present on each day for a constantly shifting daily dataset

I have searched a lot for a solution to this, but have found nothing. Maybe that's because it's a little hard to describe, or at least, I'm having trouble describing it for a search engine.
I have two columns of dates, the first column is the date a purchase order was received to be inspected, the second is the date that purchase order was accepted or rejected. What I would like is a graph with dates on the X-axis, and then the number of purchase orders in the queue on that day on the Y-axis.
Some purchase orders are completed that day, so they would still be counted, but they might not get addressed for days or weeks, so they would be counted on all those days until they were addressed.
I've been trying to do this with a formula, but am stumped. I feel like I might need to use multiple formulas, or go over to VBA, but my VBA is a little limited.
Edit: Here is a sample dataset.
Date In Date Out
9/1/18 9/1/18
9/1/18 9/1/18
9/1/18 9/2/18
9/1/18 9/3/18
9/2/18 9/2/18
9/2/18 9/4/18
So, it would be 4 for 9/1/18, 4 for 9/2/18, 2 for 9/3/18, and 1 for 9/4/18.
I have tried using COUNTIFS, but I don't know how to check between the two columns for the "between" dates.
If your data is in column A and B. Put your dates in column C (the X axis of your chart), then in column D you can write =COUNTIFS($A$1:$A$1000,"<="&C1,$A$1:$A$1000,">="&C1). The COUNTIFS function will consider that for each row of data, all conditions must be met to be added to the count (a little weird, but definitely useful). See screenshot.

Excel - Analyse the best weeks sales

If I had a better idea how to do this, I would have been more specific in the topic ;)
I have a list of repetivite sequencial dates in column A, and the profit in column B.
I'd like to analyse which sequencial 7 days have been the most profitable.
01/01/2013 10
04/01/2013 15
08/01/2013 12
08/01/2013 21
09/01/2013 18
13/01/2013 20
16/01/2013 14
19/01/2013 25
In this example the week commencing the 13/01/13 was the most pofitable with 59.
I have 4 years to anaylse of 3000 sales.
I really appreciate any assistance or starting point.
Add two more columns YEAR and WEEKNUM in the same sheet and do a pivot
Pivot :
I found the solution was possible using the following code:
=SUM(INDIRECT("$B$"&MATCH(A1,$A$1:$A$10,0)):INDIRECT("$B$"&MATCH(A1+6,$A$1:$A$10,1)))
Using the MATCH function I was able to find the first CELL for the sale of the day (01/01/13), and then the CELL of the final sale of the day +6 days in (04/01/13)
Then using the INDIRECT function I SUM the two cells together to give me the largest range of sales in any 7 day period.
Thanks to those that helped and suggested good starting points.
I would start by getting rid of duplicate days from the left column by adding their profits together.
Then perhaps you can apply some of the answers to this question: How to find maximum of each subarray of some fixed given length in a given array

Resources