Hi I need to calculate the average of a rolling difference in excel, Ideally using one formula
For example on the below data set the average of the 3day difference would be
A
1
2
3
4
5
8
9
1
`Average(A1-A4, A2-A5,A3-A6,A4-A7...etc)
Ideally I'd like build something where I can calculate the average difference between y number of days.
Is there an easier way without having to build out a difference matrix?
So my formula would look like this
=(SUM(INDEX(A:A,COUNT(A:A)-2):INDEX(A:A,COUNT(A:A)))-SUM(A1:A3))/(COUNT(A:A)-3)
assuming the data starts in A1 with no headers and there are at least 4 numbers.
Related
So I ran about 200 agent-based model runs and I want to see how the average is changing over time.
For example if we have 10 points
2 4 2 8 6 5 9 8 1 3
I want to calculate the average as the number of points changes
(2+4)/ 2 = 3
now for the next point it will be (3+2)/2 = 2.5
so I can plot each average and see after how many runs does the average stabilize. Something like this image < https://imgur.com/a/VXeeuxy > Can someone provide an equation or method?
Thank you
I think you just want a 'cumulative average' of 1,2..n points. You can do this in a single formula if you don't mind using offset:
In most versions of Excel (F1):
=SUBTOTAL(1,OFFSET(B23,0,0,1,COLUMN(B23:K23)-COLUMN(A23)))
In Excel 365 only (F2):
=SUBTOTAL(1,OFFSET(B23,0,0,1,SEQUENCE(1,COLUMNS(B23:K23))))
Or a more dynamic version that works for a whole row (F3):
=SUBTOTAL(1,OFFSET(B23,0,0,1,COLUMN(A1:INDEX(1:1,COUNT(23:23)))))
and (F4)
=SUBTOTAL(1,OFFSET(B23,0,0,1,SEQUENCE(1,COUNT(23:23))))
I do not want to know the traditional frequency or the traditional averages; so I'll give an example below:
I have this data:
1
3
5
5
2
3
5
5
1
3
The analysis that I would like to obtain is the following:
for example number 1 appears once every eight rows, number 3 appears once every four rows, number 5 appears twice every two rows....
I did it by hand, but now I have more than 21000 rows of data and I'm stuck.
I searched but I can not find a function that does it; But before I started developing my own, I decided to ask for a guide on how to achieve it.
I believe that I was able to achieve the desired result:
The formula is:
Or, if you want to copy/paste:
=IF(CONCATENATE("1-",MATCH(D1,INDIRECT(ADDRESS(MATCH(D1,A1:A17,0)+1,1,4)&":A17"),0))="1-1",CONCATENATE("2-",MATCH(D1,INDIRECT(ADDRESS(MATCH(D1,A1:A17,0)+2,1,4)&":A17"),0)-1),CONCATENATE("1-",MATCH(D1,INDIRECT(ADDRESS(MATCH(D1,A1:A17,0)+1,1,4)&":A17"),0)))
Note that the IF function solves the duplicates (like the number 5). In case you have triplicates you will have to add another instance of IF and adjust the formula accordingly.
Hope that helps!
Well this doesn't exactly reproduce your results, but you could start by looking at the max and min separation of the numbers:
=IF(COUNTIF(A$1:A$10,C2)<=1,"",MIN(IF((ROW(A$1:INDEX(A$1:A$10,COUNTIF(A$1:A$10,C2)+1))>1)
*(ROW(A$1:INDEX(A$1:A$10,COUNTIF(A$1:A$10,C2)+1))<=COUNTIF(A$1:A$10,C2)),
FREQUENCY(IF(A$1:A$10<>C2,ROW(A$1:A$10)),IF(A$1:A$10=C2,ROW(A$1:A$10)))))+1)
=IF(COUNTIF(A$1:A$10,C2)<=1,"",MAX(IF((ROW(A$1:INDEX(A$1:A$10,COUNTIF(A$1:A$10,C2)+1))>1)
*(ROW(A$1:INDEX(A$1:A$10,COUNTIF(A$1:A$10,C2)+1))<=COUNTIF(A$1:A$10,C2)),
FREQUENCY(IF(A$1:A$10<>C2,ROW(A$1:A$10)),IF(A$1:A$10=C2,ROW(A$1:A$10)))))+1)
This gives the min or max number of rows between each occurrence of the particular number.
Must be entered as an array formula using CtrlShiftEnter
You could add other statistics (like mean, standard deviation) the same way although the average could be calculated just by (lastrow-firstrow)/(count-1) e.g. for 5 it would be (8-3)/(4-1)=5/3.
Been working on an industrial solution since December. Narrowed it down to daily 4 variables.
Columns of variables A B C D
Day 1 Results 2 3 2 2
Day 2 Results 2 3 2 3
Using the and function, I combine the day to day change into a single number 23222323
I then have a table with all possible outcomes
Lookup Table Of Possible Results In Ascending Order (Expressed as whole numbers)
22122212 Fail
23222323 Good
23233333 Poor
33202322 Excellent
33333322 Undetermined
I can't figure out how to look up the daily result of a built up number using the formula A1&B1&C1&D1&A2&B2&C2&D2 to a table of real numbers in order to return the result "Good" in this example.
Try this:
=VLOOKUP(A1&B1&C1&D1&A2&B2&C2&D2,<lookup_table_range>,2,0)
If your 22122212 (for example) is stored as a number in the lookup table you will need to convert the lookup value to a number as well.
=VLOOKUP(--(A1&B1&C1&D1&A2&B2&C2&D2),<lookup_table_range>,2,0)
I want to be able to calculate the average a student, however, if it finds a specific number between the averaged subjects, then it will return that specific number AND NOT calculate the average.
Example:
If Jack has the following averaged grades in some amount of subjects - 2 3 4 5 5 - then I would want Excel to calculate the average. The answer would be 3.8.
However, if Josh has the following averaged grades - 1 2 3 4 5 - then I would want Excel to return 1 has Josh's average because it found a specific given number in his averaged grades, in this example that would be 1. I want it to return 1 as an answer, and not 3.
I don't know if it makes any sense. I tried to make it understandable. I tried mixing up varies functions, but with no results. Do I have to use VBA for that?
Use this formula:
=IFERROR(INDEX(A:A,MATCH(1,A:A,0)),AVERAGE(A1:A5))
Try,
=if(countif(A:A, 1), 1, average(A:A))
=IF(ISNUMBER(MATCH(1,A1:A5)), 1, AVERAGE(A1:A5))
=IF(SUMPRODUCT(--(A1:A5=1)), 1, AVERAGE(A1:A5))
Working an a project with many more possible combinations and I'm not sure how to approach it, so I'm going to ask how to do it on a smaller scale and then apply it to a larger scale.
I have to buy 1 of product A and 1 of product B
They both come in 100 varieties at different prices.
For product A:
TABLE 1 (A1:B6)
Dollars-Versions
1-15
2-20
3-30
4-20
5-15
and Product B
TABLE 2 (C1:D6)
Dollars-Versions
1-40
2-30
3-20
4-5
5-5
I know the minimum I can spend is $2 (600 combinations) & the Max is $10 (75 combinations), and there are 10000 (100x100) total combinations
If I put the dollar values 2-10 in cells E2:E10, is there a formula to quickly determine the number of combinations for each net dollar value in cells F2:f10?
I imagine it would have to be done with an sumif array formula, but I can't start to figure out what it would be. If I had a small data set like this, I would make a crosstab, but my data set is too large to do it efficiently.
Thank you in advance!
You would need a formula like this:-
=SUM((A$2:A$6+TRANSPOSE(C$2:C$6)=F2)*B$2:B$6*TRANSPOSE(D$2:D$6))
which would have to be entered as an array formula using CtrlShiftEnter
It builds up a 2D array with ones at the elements where the corresponding cells in the two lists add up to the amount you have to spend, then multiplies it by the corresponding numbers of combinations.