Value within the range

Mandy_84

Board Regular
Joined
May 29, 2017
Messages
71
Hi! I desperately need a help. How can I compare value to a range of values in a single cell? E.g. column A contains 5, 17, 4, 9 etc. column B contains 6-5, 19, 5-4, 9 etc. and column C should show 0, -2, 0, 0 etc. Hope that makes sense....I was trying IF, AND formulas, but no success(((
 

Excel Facts

Which came first: VisiCalc or Lotus 1-2-3?
Dan Bricklin and Bob Frankston debuted VisiCalc in 1979 as a Visible Calculator. Lotus 1-2-3 debuted in the early 1980's, from Mitch Kapor.
Exactly what are you trying to do? Do you want to compare the value to other values in the column or to other columns? What do you want returned?
 
Upvote 0
Well,I need to compare column A values vs column B values, so in return to get the comparison, e.g. In column A row 1 got 5 and in column B same row it's 6-5, thus Column C row 1 should give u 0 since 5 is actually within the range 6-5...does it make sense?
 
Upvote 0
In column B you have 6-5 as text?
What should be returned if it is not in range?
 
Last edited:
Upvote 0
If you do have 6-5 in text in column B this should work. Not sure if the higher number always comes first in B so I used Min and Max. If your last number is more then 999 digits long you will need to increase the 999 in red.
change the 0 to what ever you want to be returned when the number is in range and the 1 to what should be returned if not in range.
Code:
=IF(AND(A1>=MIN(LEFT(B1,SEARCH("-",B1)-1)+0,MID(B1,SEARCH("-",B1)+1,[COLOR=#ff0000]999[/COLOR])+0),A1<=MAX(LEFT(B1,SEARCH("-",B1)-1)+0,MID(B1,SEARCH("-",B1)+1,[COLOR=#ff0000]999[/COLOR])+0)),[COLOR=#ee82ee]0[/COLOR],[COLOR=#0000ff]1[/COLOR])
 
Upvote 0

Forum statistics

Threads
1,214,881
Messages
6,122,074
Members
449,064
Latest member
MattDRT

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