How to compare multiple values from different columns in excel? - excel

I have some difficulties with my IF formula.
I have the following columns that represent some subjects and the points that I managed to get for those subjects (F:H). In column I , I would like to compare my points with another table(M:N) that contains the minimum amount of points needed to pass the course .If my score is equal or greater then what the corresponding score is in column N, I would like to show PASS or FAIL in column I.
I Used the following formula but when comparing with M:N it keeps going down (outside the table) giving me in the end all the exams as passed.
=IF(AND(F2:$F$6=M2:$M$6)&H2:$H$6>=N2:$N6;"PASS";"FAIL")
F H I M N
(Subjects) (Points) (Subjects) (Points to Pass)
Mathematics 85 Mathematics 85
English 88 English 70
French 78 French 60
Chinese 56 Chinese 60
Physics 70 Sports 80
Sports 95 Physics 80

You could use:
=IF(H2>=VLOOKUP(F2,$M$2:$N$7,2,FALSE),"PASS","FAIL")
Results

Example formula should look like this:
=IF(H1>=INDEX($N$1:$N$6,MATCH(F1,$M$1:$M$6,0)),"PASS","FAIL")

Let your table layout housed in F1:N7 include header
In I2, formula copied down :
=IF(H2>=VLOOKUP(F2,M:N,2,0),"PASS","FAIL")

Related

extract values based on two columns

I would like to extract a price value based on two other columns. In table 1, I am given the raw data where I want to draw from. In Table 2, I am given only the contract number, and I would like to find the type being "Mater" and have the price listed out for it.
I've tried to use this formula but I don't think I am calling the columns correctly.
=IF(AND(Table2!A1=Table1!$A$1:$A$6,Table1$C$1:$C$6="Mater"),Table1!$D$2:$D$6,"")
Is there a formula using index match, if(and), or another one that could work in this case?
Thank you!
Table 1.
Contract
Work
Type
Cost
5321a
aaa
Labor
52
5321a
ab
Mater
57
5641a
aba
Mater
10
536451a
aae
Labor
75
2441a
aan
Labor
42
53421
aar
Mater
14
Table 2
Contract
Mater Cost
5321a
57
5641a
57
53421
14
The following should work:
=SUMIFS(Sheet1!D2:D7,Sheet1!A2:A7,A2,Sheet1!C2:C7,"Mater")
(I'm assuming the first table in on Sheet1)

Is there a way to match a value to a range in a lookup table?

I have two separate tables in an Excel worksheet, as illustrated below. 
Columns A, B, E, F and G are my input values;
I want a formula that generates the values in Column C
(shown in italics):
 
A
B
C
D
E
F
G
 1
Name
Value
Type
Type
Lower
Upper
 2
Andy
35
Spam
Spam
35
39
 3
Mark
85
Foo
Ham
25
27
 4
Pat
28
N/A
Eggs
91
95
 5
Deb
93
Eggs
Foo
82
86
 6
Emily
92
Eggs
Bar
65
69
 7
Greg
22
N/A
 8
Gary
67
Bar
For each row in the first table (i.e., each person),
I want to find that person’s Type based on their Value (Column B)
by finding the row in the second table where the person’s Value
falls within the Lower→Upper range (Columns F and G). 
So, for example, Mark (Row 3) has a Type of “Foo”
because his Value (85) falls between 82 and 86,
associated with “Foo” in Row 5 of the second table. 
Note that Pat’s Value is 28 (Row 4), which does not match any range.
The ranges are inclusive. 
For example, Andy’s Type is “Spam” (Row 2) even though his Value (35)
equals the Lower end of the range for “Spam” (Cell F2).
I know nested IFs are quite hard to debug in Excel,
so I’d like to avoid that if possible.
Modify your source table to show the lower limit for each grade and then use a VLOOKUP with a approximate match
Update to show how to include blank ranges
Filter Solution
If you don't have access to the FILTER function, one option is an INDEX/MATCH array formula, which will need confirmed with Ctrl+Shift+Enter.
=INDEX($F$2:$F$6,MATCH(1,($G$2:$G$6<=B2)*($H$2:$H$6>=B2),0),)
Another option is LOOKUP, which does not need Ctrl+Shift+Enter.
=LOOKUP(1,1/(($G$2:$G$6<=B2)*($H$2:$H$6>=B2)),$F$2:$F$6)

Tableau - lookup letter grade from range

I have two Excel spreadsheets. One contains average numerical grade for a student and the other a list of letter grades for numeric grades between a min and max
Spreadsheet 1
Student Avg Letter Grade
Mike 91
Joe 76
Mary 84
Sally 78
Spreadsheet 2
Min Max LetterGrade
90 100 A
81 89 B
71 80 C
61 70 D
0 60 F
How do I return the proper grade for each student in Tableau? It seems trivial but I can't figure out the calculation. Thank you for your help!!!
There is an easier way to do this by using Groups.
Import Spreadsheet 1 as a data source
Right Click on "Avg" and select Create Group
From there use Shift Click to group your ranges using Spreadsheet 2 as your reference, using labels "A, B, C"
On the top of the Create Group dialog box, make sure you rename your Field Name as "Letter Grade"
The weakness of this approach is that you have to check/redefine your groups if you are updating your data source. Using IF-ELSEIF statements may be more flexible as Inox suggested in the comments. But this is a relatively easy trick, without any programming involved. :-)
For more info, visit: http://kb.tableau.com/articles/knowledgebase/use-ad-hoc-groups-categorize
Hope this helps!

Return Kth largest Value of range that is determined by an Index & Match lookup

My question is similar to one asked here, but I am having trouble making this work for my situation given my data. I have a data set that uses seeded numbers in row 1 that I use to index match columns. This is because there are drop-down menus that change the match column based on user selection. So the the columns cannot be directly referenced. My data very roughly looks like this:
45 46 50 28
Route
CCS 500 325 40 200
CCS 370 100 380 10
RCS 90 825 50 999
CCS 100 50 32 358
So when my user makes a selection, the number in AE2 changes to reflect the column seed I want (in example, either 45, 46, 50, or 28). I want to be able to return the Kth largest number in that column that is also "CCS". So lets say the user chooses 46 and I want the 2nd largest number that has "CCS" in Route. So the formula searches row 1 for "46", then once it finds the column with it, it looks down that column for the 2nd largest CCS value -- which is 100. I have tried to modify the formula suggested in the other question, (below) but that just seems to stop at the first observation, and I need it to search all of the observations.
LARGE(IF( 'Program Data'!O:O="CCS", INDEX('Program Data'!$A:$GB,0,(MATCH($AE$2,'Program Data'!$1:$1,0)))),1)
Any tips as to what I'm doing wrong?
Your formula works for me....but it's an "array formula" so you need to confirm with CTRL+SHIFT+ENTER so that curly braces like { and } appear around the formula

Find what range a number belongs to

Ive written a function to calculate what MARK a student gets, based on a scoring table.
Why does my function work only for A mark?
This what the excel sheet looks like
COLUMN: A B C
Student SCORE MARK
1 adsf 90 A
2 asgfd 89 FALSE
3 A 90 100
4 B 81 89
5 C 71 80
6 D 61 70
7 E 56 60
8 Fx 0 55
This is the function:
{=IF(B1>=$B$3:$B$8,IF(B1<=$C$3:$C$8,$A$3:$A$8))}
I'm using {} brackets for array functions. (CTRL SHIFT ENTER)
Thank you
You're on the right track but your formula is returning an array not a single value. Wrapping the result in LOOKUP should give the desired result:
=LOOKUP("Z",IF(B1>=$B$3:$B$8,IF(B1<=$C$3:$C$8,$A$3:$A$8))
This returns the last matching grade since "Z" is larger than any other text value in the range.
A simpler method is:
=LOOKUP(-B1,-C$3:C$8,A$3:A$8)
The negative signs are needed so that the lookup values are in ascending order.

Resources