Excel: Returning a specific value if found - excel

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))

Related

count how often a piece of information appears and calculate that average

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.

Using an array to take average of rolling difference in excel?

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.

How to calculate average of first two highest number of a range?

write a formula in cell E2 to calculate the average of two highest cumulative numbers among three students after converting the obtained numbers in hundred
To get the maximum you can use max and to get the second largest number you can use large. Add the two numbers and divide them by two:
=(MAX(B3:D5)+LARGE(B3:D5,2))/2
I cannot follow your question fully. Do you want the top 2 grades, even if they are from the same student? Then #Ralph answer does it. It does not however take into account the 30% values you have in row 1.
If you want the top 2 student grades (e.g. each student can only take 1 place). Do this:
Solution

Percentage Calculation Formula

I am trying to calculate score that has 5 sections( minimum of 3 questions per sections). Among these some can be N/A. I need to calculate in such a way that the first 4 parts should be (Total Yes answers) / (total Yes+NO questions) * 10 and the 5th part should be multiplied by 60. Finally I need to sum all 5 parts to get a final score .
My Solution : (first 4 parts)
=IFERROR((COUNTIF(D70:D72,"Yes")/SUM(COUNTIF(D70:D72,"Yes"),(COUNTIF(D70:D72,"No"))))*10,"N/A")
The above formula continues for other 3 sections with different range values
5th part :
=IFERROR((COUNTIF(D70:D72,"Yes")/SUM(COUNTIF(D70:D72,"Yes"),(COUNTIF(D70:D72,"No"))))*60,"N/A")
Final Score :
=AGGREGATE(9,6,(G30,G42,G52,G64,G73))/100
I tested my formula having one section has N/A and other has YES. This gives me a result of 90% rather than 100%
My question is what if one of the parts is completely n/a. then how I should ignore the n/a section and still get 100%
In your final calculation, rather than dividing by 100 you need to divide by the sum of the possible points. There will be a more elegant way to do this, but since there are only five of them:
=AGGREGATE(9,6,(G30,G42,G52,G64,G73))/SUM(IF(ISERROR(G30),0,10),IF(ISERROR(G42),0,10),IF(ISERROR(G52),0,10),IF(ISERROR(G64),0,10),IF(ISERROR(G73),0,60))
Yeah !It did work Finally ! Thanks a lot for your guidance !
=IFERROR((SUM(G30,G42,G52,G64,G73)/SUM(IF(G30="#N/A",0,10),IF(G42="#N/A",0,10),IF(G52="#N/A",0,10),IF(G64="#N/A",0,10),IF(G73="#N/A",0,60))), "-")

sports scoring in multiple phases in excel

I have a question about excel.
There is a sports tournament with multiple phases. And the results page looks something like this:
rank phase1 phase2
1 TOM ALBERT
2 MATT TOM
3 ROBIN MATT
The first place gets 5 points, second 3 and third 1 points.
So the summary I would like to get is like this
rank name phase1 phase2 total
1 TOM 5 3 8
2 ALBERT 0 5 5
3 MATT 3 1 4
4 ROBIN 1 0 1
I cant figure out how to generate it simply, so if I copy-paste the results from phase3 to somewhere in my excel sheet, the summary page would also update.
If you can support me with advice or just a working template, I would be thankful!
Thank you for your time!
I've done you a basic example below...just list all 50 players in the summary page and copy the formula down as it is - as per the question it only records a value for the top 3 places, hope this helps if not please let me know :)
Example file here
Assuming the structure you defined and that when you paste phase 3 it will have its header ("phase3") on the same row as the other results, you could have the following formula on your Table 2:
{=SUM(IF(IFERROR(MATCH($B2,INDIRECT("Sheet1!"&CHAR(64+MATCH(C$1,Sheet1!$1:$1,0))&":"&CHAR(64+MATCH(C$1,Sheet1!$1:$1,0))),0)-1,0)={1,2,3},{5,3,1},0))}
Note: entered as Array formula: CTRL + SHIFT + ENTER
Formula uses the Table 2 headers ("phase1","phase2", etc.) and the players names to find the results for each phase. It then uses the predefined arrays that determine points given per position. The final sum is to bring the result that are in array (other values in array are 0) into single value.
Total would sum results per player.
Under the rank cells you would place the following formula:
=RANK(F2,$F:$F)
Which would provide you the rank of each player (Column F containing the totals).
Note that this would not sort your rank automatically but you could easily do this with Sorting or Autofilter. Hope this helps. Cheers.

Resources