Dynamic Average Orders Per Day Counter By Date - excel

I have been having some trouble figuring this out for the last hour, I hope one of you can help me out :)
So I have figured out the formula to calculate the average orders per day like so:
{=COUNTA(A2:A7)/SUM(1/COUNTIF(A2:A7,A2:A7))} 'PRESS (CTRL + SHIFT + ENTER)'
DATA:
A
1 | ORDER DATE
2 | 12/05/2019
3 | 12/05/2019
4 | 12/05/2019
5 | 15/05/2019
6 | 16/05/2019
7 | 22/05/2019
8 |
9 |
10|
RESULT:
1.5
My formula works fine to calculate only until A7. How would I make the formula dynamic so that it can calculate future data entries until A10 and/or infinity down the A column?
Thank you

The cell with the last date in column A can be retrieved with,
index(A:A, match(1e99, A:A))
Put this into your formula like,
=COUNTA(A2:index(A:A, match(1e99, A:A)))/SUM(1/COUNTIF(A2:index(A:A, match(1e99, A:A)), A2:index(A:A, match(1e99, A:A))))
This is a non-volatile solution (unlike OFFSET). It will only recalculate when something that affects the formula changes; not when anything in the workbook changes.

Try,
A2:A7 -> OFFSET(A2,,,COUNTA(A:A)-1)
= COUNTA(OFFSET(A2,,,COUNTA(A:A)-1))/SUM(1/COUNTIF(OFFSET(A2,,,COUNTA(A:A)-1),OFFSET(A2,,,COUNTA(A:A)-1)))

Related

SUMIF and DATEDIF by row

I have a row of dates, with one date per column. Dates are in order from oldest to newest. I am trying to count only those where the difference is 14 days or greater. I need it to count by row
Date A | Date B | Date C | Date D | 2
So Date B - Date A = 13| Date C - Date B = 29| Date D - Date C = 15| 2
The formula should return 2, since the first was less than 14 days.
I've spend hours on various forums with no luck. I never post since I am usually able to figure my problems out by reading other's kind posts & suggestion. I appreciate whatever help comes my way.
You can do it with SUMPRODUCT:
=SUMPRODUCT(--(B1:D1-A1:C1>=14))
Note the offset but same size ranges.
If you use a helper row, you can combine simple subtraction with a COUNTIF():
So in A2, put =B1-A1 and drag right.
Then in E2: =COUNTIF(A2:D2,">=14")

Using SUMIF on a range of columns or SUMPRODUCT to ignore text items

I have a range with various text and numbers in them. I wish to total the numbers based on the identifying first column.
I have tried
=SUMIF(A1:A20,"John",B1:E20)
which only returns the first columns number. I've also tried
=SUMPRODUCT((A1:A20="John")*(B1:E20))
but as there is text in column C, it returns #VALUE!.
A | B | C | D | E
John | 5 | Wine | 2 | 7
Sean | 6 | Beer | 5 | 2
I want all of the numeric values in columns B-E to be totalled together when "John" is in column A
Here is an array formula solution - use Ctrl, Shift and Enter to confirm:
=SUM(IF(A1:A20="John",IF(ISNUMBER(B1:E20),B1:E20)))
If you just want to exclude column C you could use this non-array formula:
=SUMPRODUCT((A1:A20="John")*(B1:B20))+SUMPRODUCT((A1:A20="John")*(D1:E20))
Alternatively, perhaps move C so it's not in the middle of your numbers.
Try this formula:
=IF(A1="John", SUMPRODUCT(--(ISNUMBER(B1:E1)),B1:E1), "")
and drag down to get sum on each row.

Excel INDEX / MATCH / MATCH across cell range

I am trying to get the formula right to lookup a value and return the cell underneath that cell, but I can't seem to get the code right and a MATCH/MATCH does not seem to do the trick (at least to the best of my knowledge).
Let's suppose my data set looks like this:
Col1 Col2 Col3
---------------------
Row 1 | P(A1) P(A2) P(A3)
Row 2 | 10.5% 11.5% 12.5%
Row 3 |
Row 4 | P(B1) P(B2) P(B3)
Row 5 | 50.5% 60.6% 70.5%
Row 6 |
Row 7 | P(C1) P(C2) P(C3)
Row 8 | 25.2% 34.6% 88.5%
Now I have a reference cell, say A1, which can have the value P(C2) and I want to return the corresponding value underneath P(C2), i.e. 34.6% in the cell A2.
I hope I am not being too cryptic and thanks very much in advance for any assistance.
Best
Max
Try the following...
F2, confirmed with CONTROL+SHIFT+ENTER...
=INDEX(A2:C9,SMALL(IF(A2:C9=E2,ROW(A2:C9)-ROW(A2)+1),1)+1,MATCH(E2,INDEX(A2:C9,SMALL(IF(A2:C9=E2,ROW(A2:C9)-ROW(A2)+1),1),0),0))

Find Dates and Sum

I'm stumped. I'm currently trying to create a time off tracker for time off.
I have two tabs.
First tab: "Overview" - This tab has three columns.
Month
Amt Used
=SUMIFS(Data!$C:$C,Data!$A:$A,"January")
This formula access the data tab, and uses the first column information and sums the amount for that month.
Amt Left
Jan
=B5+$G$4
Feb
=C5+B6+$G$4
This adds the amount left, with amount used and adds the accrual rate with it each month.
Then to the right, I have "Accrual Rate" and the cell next to it is variable. It is the place to put the amount of hours accrued in a month. (The forumla will multiple it by 12 months to simplify for the user)
Done with first tab.
Second tab: Called "Data"
This is where one can put their days off.
This is nothing fancy. Three untitled columns.
a cell with a formula:
=IF(B1="","",TEXT(B1,"mmmmmmmm"))
Next column is the date in mm/dd/yyyy format.
Next column is the amount of hours used. Negative for "using hours" and positive number for "gaining hours".
Now, maybe I did not need a long explantion to ask this question. I'm trying to remove the column that figures out the month. Is there a way to use the Sumif command to find by date within the formula?
If the dates are:
1/1/2013 | -8 |
1/2/2013 | -8 |
1/3/2013 | -8 |
1/4/2013 | -8 |
2/2/2013 | -8 |
2/3/2013 | -8 |
2/4/2013 | -8 |
Is there a way to say, if the month is "1" or Jan, sum the total of the cell next to it? In this case, the answer should be 32.
With SUMIFS you could sum between 1st and 31st Jan, e.g.
=SUMIFS(Data!$C:$C,Data!$B:$B,">="&DATE(2013,1,1),Data!$B:$B,"<="&DATE(2013,1,31))
or probably better to reference a cell with the date, so say you have 1st Jan 2013 in B3 in Overview tab that would be:
=SUMIFS(Data!$C:$C,Data!$B:$B,">="&B3,Data!$B:$B,"<="&EOMONTH(B3,0))
The latter formula can be copied down for multiple months

Please help..Anyone know how can I make a chart to sum all the data of each week only if values are greater than 0?

Basically I have a table like this:
Week | Value
1 | 2
2 | 3
2 | -1
2 | 1
2 | 1
3 | 4
3 | 2
6 | 4
7 | 1
I need a chart to show the sum of the values for each week only if the value is greater than 0.
so
week 1 --> 2
week 2 --> 5
week 3 --> 6
week 6 --> 4
week 7 --> 1
Anyone have any idea how to do this?
If you have Excel 2007/2010, you can use the newer function SUMIFS as below:
=SUMIFS(Week_Values,Week_Numbers,This_Week2,Week_Values,">0")
This is two criteria, so you either need an intermediate column, or an array formula.
Option 1 - Extra Column:
Add a 3rd column, which has =IF(This_Value>0,This_Value,0) (where This_Value is the cell for that row with the value in it) and then do your SUMIF on the week number to sum up the new column; OR
Option 2 - Array Formula:
For each week number as This_Week in its own cell: =SUM(IF((Week_Numbers=This_Week)*(Week_Values>0),Week_Values,0)) which you must finish up with Ctrl-Shift-Enter instead of just Enter. More on Array Formulas at cpearson.com and Microsoft.
When you have more than one condition you could use SUMPRODUCT (simpler than Array formulas).
In this case suppose you have the data you propose on the cells A1:B10 (with column names Weeks and Values in A1:B1).
then put in D2 the number of the week for which you want the sum (say: 2)
Then:
=SUMPRODUCT(($A$2:$A$10=$D2)*($B$2:$B$10>0)*$B$2:$B$10)
would do.
PS: be aware that you must esclude the column names from the selection of SUMPRODUCT (i.e. do not use $A$1:$A$10 in the above formula)

Resources