I'm using MS Excel 2010; I'm a total newbie to using functions, so be kind when answering.
I'm creating a sports grading sheet that will help instructors calculate the test scores for their students. So far I've set up excel to add a students individual points in a column and then give a percentage value out of 100%
What I want to do now is have the percentage value be converted to a selection of text result. For example, if a student gets 76.76% on their test; then their mark is considered a 'conditional pass' as it falls between the ranges of 75%-85%
I need excel to determine which range their test results fall under and then automatically enter the text result in the cell underneath, e.g.:
Name: Student
Percentage total: 76.76%
Result: Conditional Pass
I'm going to have to assign every possible number (including decimal points) to one of three text results.
Hope this makes some sense.
Thanks!
Jeepeds answer is a great way to do this, so I'll help you a bit more.
Jeeped specified a table of values in his answer using {0,0.5,0.75,0.85,0.95} which will work, but it means the values are in every formula of every cell. The way below allows you to maintain a separate list of values that define the result text associated with a range of percentages
I would set up a a range with a table of values as follows.
LowerMark UpperMark ResultText
0.0 0.50 Fail
0.50 0.60 Ok Pass
0.60 0.75 Contional Pass
0.75 0.85 Good Pass
0.85 0.90 Excellent
0.90 1 Brilliant
1 9999 This should never happen
Lets say the above table is in sheet2 in cells A1 to C7.
Note that the upper mark column is not really needed, but it helps "read the table". (It could be set using a formula that gets it's value form the next rows LowerMark)
In you main list that has the pupil marks, the cell that you want to display the "Result Text" will need a formula like the following. This formula refers to cell D6 which is the cell that has the numeric percentage they obtained.
=VLOOKUP('Sheet2'!$A$1:$C$7, D6, 3, TRUE)
Note that the table of values assumes that you are calculating and storing the percentage for each child as a number that ranges from 0 to 1 (not 0 to 100)
Related
So l have a 2 column table, with the first column being size, and the next column being weight. I want to create an input where I get a user to type in the object size, and the next cell just spits out the corresponding weight. Is there anyway to do this in excel?
size weight
1 12
2 15
3 20
For example given the table above I want a user to just type in '2' for size, and an output cell will spit out '15'.
So far I've tried using structured table references, but they only refer to columns? I don't know how to get it to associate a size with the weight in the cell right beside it.
There isn't a formula I can use either that takes the size of the object and spits out the weight either, because the values come from a numerical solution that the scientific paper I'm looking at doesn't specify.
You can use vlookup like so:
=VLOOKUP(D1,A:B,2,0)
User enters the size in D1 and D2 spits out the weight.
Try just LOOKUP() Function
• Formula used in cell E2
=LOOKUP(E1,A2:B4)
I am trying to calculate a running average on a filtered data table. All other posts online use Sumproduct(Subtotal) on the entire range but do not calculate a row by row running average
I am stuck on how to calculate columns C and D.
If column B (Score) > 0, I want to sum and average it under column C (Average Win)
If column B (Score) < 0, I want to sum and average it under column D (Average Loss)
The table is filterable by column A (Type) and the results should look as follows
Progress so far:
I have figured out how to calculate a Cumulative score based on filtered data. However this does not fully solve my problem. I appreciate any help!
=SUBTOTAL(3,B3)*SUBTOTAL(9,B$3:B3)
SUBTOTAL(3,B3) checks if the current row is visible, SUBTOTAL(9,B$3:b3) sums the values.
Final update needed
Jos - Thank you for your detailed explanation on how subtotal() works. I learned a ton through your explanation and will continue to study it. This is my first time being exposed to structured referencing so some of the syntax is a bit confusing to me still
The last formula I need is a running win % column where a Win is defined by score > 0. Please see the picture below
My assumptions believe that the same formula would work, except that we average a 1 or 0 in each row instead of the [Score] column.
Using the prior solution, why can't we modify the output of your prior solution to calculate a running win %?
[...] IF([Score]>0,IF(ROW([Score])<=ROW([#Score]),[Win])))),0)
Where [Win] is a helper column with the outputs 1 for win, 0 for loss.
This could be done by saying
if([#score]>0,1,0)
Instead of averaging out the actual #Score, this would average out a column of 1's and 0's with the desired output 0%, 50%, 66%, etc.
I am aware that the solution I provided does not work but I am trying to embrace the correct logic. I still struggle to understand how these structured column references are calculated on a row by row basis.
For example: Average(If([Score]>0,[Score])
How is this calculated on a row by row basis? When A3 does If([Score] > 0,), does this equal If({-10}>0)? When on A4, does If([Score]>0) equal If({-10,20} >0)? Thank you for your patience and help thus far.
I disagree with your result for Average Loss for the last row of your unfiltered table (surely -9.33...?), but try this for Average Win:
=IFERROR(AVERAGE(IF(SUBTOTAL(3,OFFSET(INDEX([Score],1),ROW([Score])-MIN(ROW([Score])),)),IF([Score]>0,IF(ROW([Score])<=ROW([#Score]),[Score])))),0)
Same formula for Average Loss, changing [Score]>0 to [Score]<0.
Explanation:
Using the data you provided and assuming:
The table's top-left cell is in A1
The table is filtered on the Type column for "A"
In order to determine which rows are filtered, we must pass an array of range references - i.e. for each cell within a chosen column of the table - to the SUBTOTAL function. It's a touch unfortunate that such an array of range references can only be generated via a volatile function (INDIRECT or OFFSET), but here, unless we resort to helper columns, we are left with no choice.
INDEX([Score],1)
simply returns a range reference to the first cell within the Score column. When using Excel tables, it's preferable not to write formulas which include a mixture of structured and non-structured referencing, even if that results in slightly longer expressions. So here, for example, we would not reference A2 within the formula.
ROW([Score])-MIN(ROW([Score]))
generates an array of integers from 0 up to one fewer than the number of rows in the table, i.e.
{0;1;2;3;4}
and so
=IFERROR(AVERAGE(IF(SUBTOTAL(3,OFFSET(INDEX([Score],1),ROW([Score])-MIN(ROW([Score])),)),IF([Score]>0,IF(ROW([Score])<=ROW([#Score]),[Score])))),0)
becomes
=IFERROR(AVERAGE(IF(SUBTOTAL(3,OFFSET(A2,{0;1;2;3;4},)),IF([Score]>0,IF(ROW([Score])<=ROW([#Score]),[Score])))),0)
OFFSET then generates an array of range references (though note that you will not be able to 'see' this step within the Evaluate Formula window - rather, an array of #VALUE! errors is displayed):
=IFERROR(AVERAGE(IF(SUBTOTAL(3,{A2;A3;A4;A5;A6}),IF([Score]>0,IF(ROW([Score])<=ROW([#Score]),[Score])))),0)
SUBTOTAL then determines which of these range references is filtered (note that care must be given here to the choice of first parameter), returning the relevant Boolean, so that:
SUBTOTAL(3,{A2;A3;A4;A5;A6})
resolves to:
{1;1;1;0;1}
And so we now have:
=IFERROR(AVERAGE(IF({1;1;1;0;1},IF([Score]>0,IF(ROW([Score])<=ROW([#Score]),[Score])))),0)
and the rest is straightforward.
So, I would use averageifs().
=averageifs(B:B,B:B,">=1",A:A,"A")
is one example, note I have added the control of Type A in the example.
See:
We have a new program in our company where in we give additional allowance based on their years of stay with the company.
My problem is I want to round down numbers if they are in between values. I created a formula where in their allowances are adjusted in a daily basis eg. D(Date of Regularization), E(Today), F(No. of Years), G(increase), h(increase per month).
There my letter "H" Column needs to be rounded down. For example our employee will be 2 years in 7 days. the allowance he receives (for now) should still be 50 (if two years it'll be 120), so what I want to do is if the value is between 50-119 it will round down into 50, if the value is between 120-219 it will be 120 and so on..
(Years*Increase=Total)(1*50=50)(2*60=120)(3*70=210)(4*80=320)
I hope somebody will understand. Thanks!
Please try this sample formula
=IF(AND(A2>=50,A2<=119),"50",IF(AND(A2>=120,A2<=209),"120",IF(AND(A2>=210,A2<=319),"210")))
You can use vlookup for this requirement.
Setup a reference table in some other part of the sheet, with the floor values you need:
E.g. This has been placed at [A2:A5]
50
120
210
320
Use the vlookup formula as below referring the values that you want to round-off. E.g.
If C2 = 50, use =VLOOKUP(C2,$A$2:$A$5,1,TRUE), result will be 50
If C3 = 119, use =VLOOKUP(D2,$A$2:$A$5,1,TRUE), result will be 50
NOTE: The last parameter in the vlookup is marked as TRUE so that it checks for approximate match and not exact match, which is the key for this solution.
You can also name the range for floor values and use that in the formulas.
I have a bunch of sequential rows and I'm trying to average the last 90 based on a criteria. The average needs to be in a single cell, rather than a column that calculates a running average. I figured out how to calculate an average for the last 90 rows, but I am not able to correctly add the if function to meet the criteria prior to averaging.
Data:
sale type (b) Data(c) Rownumber (E)
a 45 1
b 35 2
c 36 3
c 56 93
Here is the average function that's working correctly AVERAGE(OFFSET(E2,COUNTA(E:E)-1,-2,-90)).
Here is the AVERAGEIF function that I'm trying to run that is giving incorrect data:
=AVERAGEIF(B:B,I15,OFFSET(E2,COUNTA(E:E)-1,-2,-90))
I15 cell in this case, is the sale type that I am trying to match.
Thanks in advance for the help!
=AVERAGEIF(OFFSET(B2,COUNTA(E:E)-2,0,-90),$I$15,OFFSET(C2,COUNTA(E:E)-2,0,-90))
first: you need to "-2", not "-1" from your row, you're not getting the last 90 with -1 .. (test it by changing a record in data to "999" at the outskirts. You'll see it pick up that value when the AVG changes dramatically.)
second: your and range have to match .. heights anyway. So use the same offset formula in both.
To slightly optimize this, you could calc that "COUNTA(E:E)-2" in another column, name it, then just reference it in both cases (that way Excel only calcs it once, not twice). ;)
Also, if the I15 cell is a single cell, you might want to $I$15 it to be safe. I don't think this matters in this case, just a habit of doing that to single, isolated cells that aren't part of a range :)
If you actually have row numbers (of the data) in column E you could use AVERAGEIFS and just use another criteria based on column E, like this:
=AVERAGEIFS(C:C,B:B,I15,E:E,">"&MAX(E:E)-90)
I am very familiar with vlookup and hlookup functions in Excel. However, I am looking for a method of doing both. Take this example:
A B C
1 Resources
2 Task Mgr Sr. Mgr
3 -----------------------------
4 Task 1 30% 70%
5 Task 2 40% 60%
6 Task 3 50% 50%
7 Task 4 70% 30%
If I wanted to put a formula in a new cell to look up both a task and a resource type to return the appropriate percentage, how could I do this?
A combination of INDEX and MATCH will do the trick:
=INDEX($B$4:$C$7,MATCH("Task 3",$A$4:$A$7,0),MATCH("Mgr",$B$2:$C$2,0))
Another possibility:
=VLOOKUP(E3,A2:C7,MATCH(E2,A2:C2,0),FALSE)
Where
E3 contains the task to look up
E2 contains the header column name
(eg Mgr)
A2:A7 is the table of data
A2:C2 is the header
Okay, assume you have an Excel sheet with the following format where your lookup table occupies the cell range A1:E5
C1 C2 C3 C4
R1 R1C1 R1C2 R1C3 R1C4
R2 R2C1 R2C2 R2C3 R2C4
R3 R3C1 R3C2 R3C3 R3C4
R4 R4C1 R4C2 R4C3 R4C4
Also assume you want to enter the row header name and column header name into cells G3 and H3 respectively (which I have the text values "R3" and "C2").
In the cell you wish to display your output value, you could either use HLOOKUP like so:
=HLOOKUP(H3,A1:E5,MATCH(G3,A1:A5,0))
or VLOOKUP like so:
=VLOOKUP(G3,A1:E5,MATCH(H3,A1:E1,0))
Either displays the value "R3C2" in my output cell.
=OFFSET(A3,MATCH("Task 3", A4:A7, 0),MATCH("Mgr",B2:C2,0))
Of course, you're probably getting the things to look for from other cells, so replace "Task 3" and "Mgr" above with references to those cells.
Okokokok so
I just figured out an alternate, much simpler answer... its an IF function!
so okay, what I mean by this is the following;
you have 2 input cells, both formatted with data validation lists. One has the tasks, and one has the position, as shown in the question asked.
now we use a vlookup function to determine what row we are going to get, and then an IF function to determine the column!!
now lets say your input cells are next to each other at E1 and F1
So an example of this formula would be,
=vlookup($E$1,$A$4:$C$7,IF($F$1="MGR",2,3),FALSE)
This works so well and can even be used with more than 2 columns by using the IFS Function!
I Hope this helps some kid in the future who did exactly what I did and went to the internet for answers after being very confused hahaha