View Single Post
  #2   Report Post  
Posted to microsoft.public.excel.worksheet.functions
joel joel is offline
external usenet poster
 
Posts: 9,101
Default Trying to figure out a formula for range of numbers?

the following function MAY do what you are asking. I returns a "Y" if it
finds one of the values in the range of cell you specify. Otherwise it
returns "N". Not suurre if it works like you want for a range containing
multiple cells. Did you want it to return "Y" if all the cells were in the
range, or if it found at least one cell in the range. I can easily modify
the function to meett your requirements.

What you want is very hard to do in an Excel spreadsheet.


Call with
=MySpecialRange(A5)
or
=MySpecialRange(A1:H100)

Function MySpecialRange(Target As Range)

For Each cell In Target

If Target = 0 And Target <= 999 Then
MySpecialRange = "Y"
Exit Function
End If
If 2430 = 0 And Target <= 2440 Then
MySpecialRange = "Y"
Exit Function
End If
If Target = 6400 And Target <= 6410 Then
MySpecialRange = "Y"
Exit Function
End If
If Target = 6380 Then
MySpecialRange = "Y"
Exit Function
End If
If Target = 6460 Then
MySpecialRange = "Y"
Exit Function
End If
If Target = 6510 Then
MySpecialRange = "Y"
Exit Function
End If
If Target = 6440 Then
MySpecialRange = "Y"
Exit Function
End If
If Target = 6520 Then
MySpecialRange = "Y"
Exit Function
End If
If Target = 6540 Then
MySpecialRange = "Y"
Exit Function
End If
Next cell
MySpecialRange = "N"
End Function


"Mary C" wrote:

Hello~

Im trying to create a formula based on ranges of numbers, as well as single
value numbers in a spreadsheet to where the out put is a value of either Y
(for yes) or N (for no) depending on where in the range of numbers my search
criteria falls........I was thinking an IF THEN OR statement, but cannot seem
to figure out the 'nesting' part of it correctly........ Here is an example
below:

I am looking for the below numbers, or RANGE of numbers on my spreadsheet,
and if found I need the output value to be Y......If NOT found, the value
returned needs to be N.
00000;00999
06380
06460
06510
06440
02430;02440
06400;06410
06520
06540

Not sure what to do.

Thanks-

Mary