I'm trying to find a way to distribute revenue to specific dates and weight out the numbers. So that if a day falls between my two reporting days, I want it to allocate it based on the difference between the reporting days. So for example if I have reporting dates
20/11/2017
30/11/2017
10/12/2017
20/12/2017
and sale dates with revenue
Sales dates Volumes
22/11/2017 600,000,000
12/12/2017 -100,000,000
13/12/2017 -141,400,000
20/12/2017 -100,962,000
I want the sale made 22/11/2017to be distributed 8/10 to 20/11/2017and 2/10 to 30/11/2017and so on, so that the 4 sales would distribute to
Reporting dates
20/11/2017 480,000,000
30/11/2017 120,000,000
10/12/2017 -178,980,000
20/12/2017 -163,382,000
I have not successfully found any solution, anyone know if I have missed something or have any good ideas how one good build such a settup?
Ok, this solution uses a lot of helper columns as I haven't had time to condense it all down. I'm sure these formula can be improved and maybe even turned into a single formula.
First step is to find the two dates that your revenue should be distributed between.
With your original data in cells A1:B4 this formula placed in cells C1:C4 will return the higher date:
=DATE(YEAR($A1),MONTH($A1),CEILING(DAY($A1),10))
and this, placed in D1:D4 will return the lower date:
=DATE(YEAR($A1),MONTH($A1),FLOOR(DAY($A1),10))
Edit: After spending a bit more time awake you could replace the above two formula with =CEILING($A1,10)-1 and =FLOOR($A1,10)-1 respectively.
Next we find where the sale date is in relation to the upper and lower dates.
In E1:E4 use:
=(C1-A1)/10
and in F1:F4:
=(A1-D1)/10
Now to return the revenue based on that distribution:
In G1:G4 use:
=E1*$B1
The formula in H1:H4 differs slightly as the 100% figure should only be returned once. The revenue for 20/12/2017 will only appear in column H.
=IF(F1=0,B1,F1*$B1)
I've placed the reporting dates in the range J1:J4; so 20/11/2017 in J1, 30/11/2017 in J2, etc.
The formula in K1:K4 is:
=SUMIF(C$1:C$4,$J1,$H$1:$H$4)
The formula in L1:L4 is:
=SUMIF(D$1:D$4,$J1,$G$1:$G$4)
Finally the formula to return your distribution will sum the previous two formula in cells M1:M4:
=SUM(K1:L1)
Related
oversimplified i have two columns: Date and Text; I want to check my current amount of vacation days based on the first date in row 2, so i came up with the following formula:
="Available vacation days: "&YEARFRAC(A2;TODAY())*12*(25/12)
I calculate the fraction of the year based on the first date and todays date, multiply it by 12 to get months and multiply it again by the total amount of vacation days in my contract per month. Now i got another formula to collect me all cells in column B containing "Vacation", pretty straight forward:
=COUNTIF(B:B;"Vacation")
Now the interesting part - i got the formula who gives me a boolean if a datetime matches the 24th or 31st of december:
=AND(OR(DAY(A53)=24;DAY(A53)=31);MONTH(A53)=12)
I want to count vacation days happening on a 24th or 31st of december as a half-vacation day (0.5), and otherwise fully (as a 1). Then i want to combine my first statement with this result and subtract the used vacation days. I read about VLOOKUP and XLOOKUP but am unsure if this fits this purpose. I want to avoid having an extra column with my boolean returns and rather have this one cell giving me all the information combined.
Without introducing another column, and using DAY and MONTH
It's nearly impossible, and just unnecessarily so...
Please reconsider this, what will happen if you want to add 4th of July as a holiday?
Your formula =AND(OR(DAY(A53)=24;DAY(A53)=31);MONTH(A53)=12) only works for 1 row at a time. So, we can't ever use it with a list, because you will get the whole list as a result every single time. You can't divide them into smaller lists and join them together, there is no such functionality without VBA.
In the future, do not set arbitrary constraints like "no additional columns", you can hide them if you don't like them. And if you don't need them, remove unnecessary rows like non-vacation rows. They are irrelevant, so why not separate the two.
Just to prove my point, here's the solution you wanted:
Solution
=COUNTIFS(B2:B9;"Vacation") - (COUNT(IFERROR(FILTER(FILTER(FILTER(A2:A9;B2:B9="Vacation");MONTH(FILTER(A2:A9;B2:B9="Vacation"))=12);DAY(FILTER(FILTER(A2:A9;B2:B9="Vacation");MONTH(FILTER(A2:A9;B2:B9="Vacation"))=12))=31);0))+(COUNT(IFERROR(FILTER(FILTER(FILTER(A2:A9;B2:B9="Vacation");MONTH(FILTER(A2:A9;B2:B9="Vacation"))=12);DAY(FILTER(FILTER(A2:A9;B2:B9="Vacation");MONTH(FILTER(A2:A9;B2:B9="Vacation"))=12))=24);0))))*0,5
It works, but it's a pain to read, use and maintain.
A2:A9 refers to the dates column
B2:B9 refers to the text column
So in the future, the last thing you want to do is set arbitrary constraints. Furthermore, why use functions like MONTH and DAY when we can just read the text? That way you could even create a table of holidays to search for instead. That will be no fun task with this setup. (Oh, and if it's because of the year, just strip it away from the text when you want to know only the month and day.
Best of luck!
So i have been playing with Excel for a while, and one thing led to another, i wanted to try this: How would i calculate the instances of dates (such as below) in one sheet
And count which of those dates fall under the 30/60/90 day period (such as below) I'm looking to see if i could have a final tally up the number of instances of dates which fall below 30/60/90 days to the current date in another sheet.
Using the table example gave that i would know that 2 dates fall under the 30/60 days period, and one fell under the 90 days period
Is there a solution to my predicament?
Edit: More accurate question
Use nested IF() function.
=IF(TODAY()-B2<=30,30,IF(TODAY()-B2<=60,60,IF(TODAY()-B2<=90,90,"Other period")))
Or try IFS() if you have Excel-365.
=IFS(TODAY()-B2<=30,30,TODAY()-B2<=60,60,TODAY()-B2<=90,90)
Another option is-
=XLOOKUP(TODAY()-B2,{30,60,90},{30,60,90},"Other Period",1)
You could try:
Formula in E2:
=SUMPRODUCT(--(CEILING(D$6-B$2:B$6,30)=D2))
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")
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.
I am working on a financial model in excel. If the number of customers is between 1-10000, the cost is .20 per customer per month, 10000-100000 is .15 per customer per month, 100k and 1MIL is .10 per customer per month and > 1MIL is .08 per month per customer.
What I would like to do is create a formula where if the cell that references the number of customers at that month is within those values above, the cost per month changes depending on the number of cstomers.
This is what I have:
=IF(AND(B6>=1,B6<=10000),$Q$6), IF(AND(B6>10000,B6<=100000),$Q$7), IF(AND(B6>100000,B6<=1000000),$Q$8),IF(AND(B6>1000000),$Q$9)
Q6, Q7, Q8, Q9 are respectively: $.20, $.15, $.10, $.08
My B6 cell is the cell that is pulling over the number of customers from another sheet.
I am getting a #VALUE! Error when I use this formula. It works if I simply have:
=IF(AND(B6>=1,B6<=10000),$Q$6) which leads me to believe that my logic is wrong with all of the IF statements, and I should be using ELSEIF but I am not sure the syntax for that.
Help is appreciated!
So this is how I fixed this issue in case anyone had the same issue:
=IF(B6<=10000,$Q$6,IF(B6<=100000,$Q$7,IF(B6<1000000,$Q$7)))
By nesting the if statements with higher values excel automatically recognizes the max value for that if statement!
It seems that you are closing the IF statements too soon. Your formula repaired would look like,
=IF(AND(B6>=1,B6<=10000),$Q$6, IF(AND(B6>10000,B6<=100000), $Q$7, IF(AND(B6>100000,B6<=1000000), $Q$8, IF(AND(B6>1000000),$Q$9))))
If you start at the upper limit, you can reduce the conditions with sequential logic.
=IF(B6>1000000,$Q$9, IF(B6>100000, $Q$8, IF(B6>10000, $Q$7, IF(B6>=1,$Q$6, 0))))
You could probably do that a little more easily like this
=IF(B6>1000000,$Q$9,IF(B6>100000,$Q$8,IF(B6>10000,$Q$7,IF(B6>=1,$Q$6,"Error))))
You don't need AND because the IF functions are implicitly checking a range because the previous IFs rule out ranges of values