Comparing in Excel

tguidry

New Member
Joined
Sep 11, 2017
Messages
4
Can I compare a range value like 33-54 to a value like 47 and come back with answer of yes or no? I have a vertical look up formula returning a range of values that I would like to compare to another value and state whether that student has met their goal or not. If the student is within the range then Yes would appear if not then No would appear. Since the range is an answer from a vertical look up table, several different ranges can come up depending on what is typed. I want to know if I can create a formula that will compare whatever range appears to the actual score and tell if it is within the range or not
 

Excel Facts

Get help while writing formula
Click the italics "fx" icon to the left of the formula bar to open the Functions Arguments dialog. Help is displayed for each argument.
vlookup with True. Set up a table with criterea you want to return (In your example it could look something like below). Then do a vlookup of the first column, returning column 3 value, with TRUE (approximate match). Note that table created must be sorted in numeric order.

[TABLE="width: 272"]
<tbody>[TR]
[TD] From [/TD]
[TD] To [/TD]
[TD] Remark[/TD]
[/TR]
[TR]
[TD="align: right"]0[/TD]
[TD="align: right"]33[/TD]
[TD] Poor[/TD]
[/TR]
[TR]
[TD="align: right"]34[/TD]
[TD="align: right"]50[/TD]
[TD] Below average[/TD]
[/TR]
[TR]
[TD="align: right"]51[/TD]
[TD="align: right"]75[/TD]
[TD] Meeting expectations[/TD]
[/TR]
[TR]
[TD="align: right"]76[/TD]
[TD="align: right"]100[/TD]
[TD] Excellent



[/TD]
[/TR]
</tbody><colgroup><col span="2"><col></colgroup>[/TABLE]
 
Upvote 0
ADV 47-57
H-AB 19-22
H-BAS 27-32
H-MAS 39-46
H-UNS 12-14
L-AB 15-18
L-BAS 23-26
L-MAS 33-38
UNS 0-11
This is my vlookup. A project goal is put in the first column L-MAS, the second column returns 33-38, the third column is a sum of total points earned 30, the fourth column is Y or N have they met their goal. I would like to be able to compare the range of numbers in column 2 to the number in column 3.
 
Upvote 0
Hi, something like this maybe:


Excel 2013/2016
ABCD
1ADV47-5730N
2H-AB19-2219Y
3H-BAS27-3232Y
4H-MAS39-4640Y
5H-UNS12-145N
6L-AB15-1850N
7L-BAS23-261N
8L-MAS33-3855N
9UNS0-115Y
Sheet2
Cell Formulas
RangeFormula
D1=IF(AND(C1>=0+LEFT(B1,FIND("-",B1)-1),C1<=0+MID(B1,FIND("-",B1)+1,13)),"Y","N")
 
Upvote 0
Hi, something like this maybe:

Excel 2013/2016
ABCD
ADV47-57
H-AB19-22Y
H-BAS27-32Y
H-MAS39-46Y
H-UNS12-14N
L-AB15-18N
L-BAS23-26N
L-MAS33-38N
UNS0-11Y

<colgroup><col><col><col><col><col></colgroup><thead>
</thead><tbody>
[TD="align: center"]1[/TD]

[TD="align: right"]30[/TD]
[TD="bgcolor: #FFFF00"]N[/TD]

[TD="align: center"]2[/TD]

[TD="align: right"]19[/TD]

[TD="align: center"]3[/TD]

[TD="align: right"]32[/TD]

[TD="align: center"]4[/TD]

[TD="align: right"]40[/TD]

[TD="align: center"]5[/TD]

[TD="align: right"]5[/TD]

[TD="align: center"]6[/TD]

[TD="align: right"]50[/TD]

[TD="align: center"]7[/TD]

[TD="align: right"]1[/TD]

[TD="align: center"]8[/TD]

[TD="align: right"]55[/TD]

[TD="align: center"]9[/TD]

[TD="align: right"]5[/TD]

</tbody>
Sheet2

[TABLE="width: 85%"]
<tbody>[TR]
[TD]Worksheet Formulas[TABLE="width: 100%"]
<thead>[TR="bgcolor: [URL=https://www.mrexcel.com/forum/usertag.php?do=list&action=hash&hash=DAE7F5]#DAE7F5[/URL] "]
[TH="width: 10"]Cell[/TH]
[TH="align: left"]Formula[/TH]
[/TR]
</thead><tbody>[TR]
[TH="width: 10, bgcolor: [URL=https://www.mrexcel.com/forum/usertag.php?do=list&action=hash&hash=DAE7F5]#DAE7F5[/URL] "]D1[/TH]
[TD="align: left"]=IF(AND(C1>=0+LEFT(B1,FIND("-",B1)-1),C1<=0+MID(B1,FIND("-",B1)+1,13)),"Y","N")[/TD]
[/TR]
</tbody>[/TABLE]
[/TD]
[/TR]
</tbody>[/TABLE]

This is almost it; however, I would like it to say "Y" for D6 and D8 if they exceeded their goals.
 
Upvote 0
This is almost it; however, I would like it to say "Y" for D6 and D8 if they exceeded their goals.

In D1 enter and copy down:

=ISNUMBER(LOOKUP(C1,CHOOSE({1,2,3},LEFT(B1,FIND("-",B1)-1)+0,REPLACE(B1,1,FIND("-",B1),"")+0,9.99E+307)))+0

A value of 1 means a hit, 0 miss.
 
Upvote 0
Thank you so much! I just changed the < to a > sign and it works. If you could be so kind as to explain this formula in layman's terms so I can learn from this, that would be great. Why do they have 0+Left and 0+mid? why do you need the -1 and +1? What's up with the 13? Sorry, just trying to learn.
 
Upvote 0
In D1 enter and copy down:

=ISNUMBER(LOOKUP(C1,CHOOSE({1,2,3},LEFT(B1,FIND("-",B1)-1)+0,REPLACE(B1,1,FIND("-",B1),"")+0,9.99E+307)))+0

A value of 1 means a hit, 0 miss.

Edit... The formula should be:

=ISNUMBER(LOOKUP(C1,CHOOSE({1,2},LEFT(B1,FIND("-",B1)-1)+0,REPLACE(B1,1,FIND("-",B1),""))))+0
 
Upvote 0
I would like it to say "Y" for D6 and D8 if they exceeded their goals.

Hi, just another option you can try:


Excel 2013/2016
ABCD
1ADV47-5730N
2H-AB19-2219Y
3H-BAS27-3232Y
4H-MAS39-4640Y
5H-UNS12-145N
6L-AB15-1850Y
7L-BAS23-261N
8L-MAS33-3855Y
9UNS0-115Y
Sheet1
Cell Formulas
RangeFormula
D1=IF(C1>=0+LEFT(B1,FIND("-",B1&"-")-1),"Y","N")
 
Upvote 0

Forum statistics

Threads
1,223,911
Messages
6,175,325
Members
452,635
Latest member
laura12345

We've detected that you are using an adblocker.

We have a great community of people providing Excel help here, but the hosting costs are enormous. You can help keep this site running by allowing ads on MrExcel.com.
Allow Ads at MrExcel

Which adblocker are you using?

Disable AdBlock

Follow these easy steps to disable AdBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the icon in the browser’s toolbar.
2)Click on the "Pause on this site" option.
Go back

Disable AdBlock Plus

Follow these easy steps to disable AdBlock Plus

1)Click on the icon in the browser’s toolbar.
2)Click on the toggle to disable it for "mrexcel.com".
Go back

Disable uBlock Origin

Follow these easy steps to disable uBlock Origin

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back

Disable uBlock

Follow these easy steps to disable uBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back
Back
Top