View Single Post
  #4   Report Post  
Posted to microsoft.public.excel.programming
Mike B[_6_] Mike B[_6_] is offline
external usenet poster
 
Posts: 3
Default Rounding Logic Question

Mark

'One option is a user defined function to use as a formula
'For example in the function below
'price is the value in col D
'rounded_range is the range in col C
'place the function in col E, make the rounded range absolute $
'and copy down 150 rows

Function Round_Value(price, Rounded_Range)
Application.Volatile
Round_Value = "error"
For Each cell In Rounded_Range 'all data cells col C

Select Case cell.Offset(0, -2) 'compare col A
Case Is <= price
If cell.Offset(0, -1) = price Then 'compare col B
Round_Value = cell.Value
Exit Function
End If
End Select
Next
End Function

HTH

Mike B