Thread: excel
View Single Post
  #5   Report Post  
Posted to microsoft.public.excel.programming
sonia sonia is offline
external usenet poster
 
Posts: 30
Default excel

The 2s 3s and everyhting else part doesn't work.

"Kevin B" wrote:

Open the VB Editor, insert a module and paste the following function into the
module:

Function MatchValue(CellValue As Long) As Long

Dim l As Long

Application.Volatile

Select Case CellValue
Case 1
l = 0
Case 2 To 3
l = 1162
Case 4 To 637999
l = 1172
Case Else
l = 1162
End Select

MatchValue = l

End Function

To use it just enter it like you would any formula, for example:

=MatchValue(A1)


--
Kevin Backmann


"Sonia" wrote:

I am trying to create a formula, which I am not the best at. I seem to make
it too long. I want it to say if a cell = 2 or 3 it should be 1162. if it
is a 4, 5 or less than 637999 then it is 1172. If is is greater than 638000
then it should be 1162 everything else is 1162. Help!!