Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 30
Default Comparing Values from 2 cells

I working on a form where there is a Value in cell B89 and there is a value
in cell F90. I need excel to determin if the value in F90 falls in the range
of the value for cell B89..

example:

cell B89 value = 3.5 - 5.0 (not minus sign) this values also changes...
Cell F90 value (user entered value) = 4.5

i need excel to see if 4.5 falls in the range of 3.5 - 5.0
  #2   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 4,339
Default Comparing Values from 2 cells

Reggie,

Try this:

e.g in Cell A1 put "=IsInRange(B89,F90)" (no quotes) and function will
return TRUE or FALSE.

in VBA:
Dim Check as boolean
Check=isInRange(Range("B89"),range("F90"))

Function IsInRange(ByRef rng As Range, cv As Range) As Boolean
Dim lv As Double, uv As Double
lv = CDec(Left(rng.Value, InStr(1, rng, "-") - 1))
uv = CDec(Right(rng.Value, InStrRev(rng, "-") - 1))
If cv.Value = lv And cv.Value <= uv Then
IsInRange = True
Else
IsInRange = False
End If
End Function

HTH

"Reggie" wrote:

I working on a form where there is a Value in cell B89 and there is a value
in cell F90. I need excel to determin if the value in F90 falls in the range
of the value for cell B89..

example:

cell B89 value = 3.5 - 5.0 (not minus sign) this values also changes...
Cell F90 value (user entered value) = 4.5

i need excel to see if 4.5 falls in the range of 3.5 - 5.0

  #3   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 703
Default Comparing Values from 2 cells

Obviously you mean the value in B89 is a string containing two numbers
separated by a space-dash-space. Those two numbers really should be put into
two individual cells, but if this cannot be done then...(here goes)...try
this crazy formula:

=IF(AND(F90=VALUE(LEFT(B89,FIND(" -
",B89)-1)),F90<=VALUE(RIGHT(B89,LEN(B89)-FIND(" - ",B89)-2))),"YES","NO")

"Reggie" wrote:

I working on a form where there is a Value in cell B89 and there is a value
in cell F90. I need excel to determin if the value in F90 falls in the range
of the value for cell B89..

example:

cell B89 value = 3.5 - 5.0 (not minus sign) this values also changes...
Cell F90 value (user entered value) = 4.5

i need excel to see if 4.5 falls in the range of 3.5 - 5.0

Reply
Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes

Posting Rules

Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On


Similar Threads
Thread Thread Starter Forum Replies Last Post
Comparing the values in two cells, then counting how many differ cgm02 Excel Worksheet Functions 2 August 29th 09 02:09 AM
Help with Comparing values and retrieving values in Excel!!!!!! [email protected] Excel Worksheet Functions 1 November 17th 06 12:21 AM
Iterating through cells, comparing values kingpin2502 Excel Programming 0 July 11th 05 06:08 PM
Comparing values in two columns and displaying missing values in n cpetta Excel Programming 1 April 2nd 05 06:18 AM
Comparing values in non contigious cells thePriest Excel Programming 3 March 3rd 05 05:21 AM


All times are GMT +1. The time now is 12:16 AM.

Powered by vBulletin® Copyright ©2000 - 2024, Jelsoft Enterprises Ltd.
Copyright ©2004-2024 ExcelBanter.
The comments are property of their posters.
 

About Us

"It's about Microsoft Excel"