Hi,
How do I return a value if it the criteria is within the range given.
As attached, how can I get the cell B21 as "B" if it's fall within the range of 1 to 1.99.
Appreciate your helps.
Regards,
Haan
Last edited by haan; 06-08-2011 at 07:07 AM.
Hello try this (copy it into sheet1 code)
working example in attached filePrivate Sub Worksheet_Change(ByVal Target As Range) Dim r As Integer Dim val As Double r = 2 'start row If Target.Address = "$B$20" Then Do Until Cells(r, 1).Value = "" If Target.Value >= Cells(r, 1).Value And Target.Value <= Cells(r, 2).Value Then Range("B21").Value = Cells(r, 3).Value Exit Sub End If r = r + 1 Loop Range("B21").Value = "" End If End Sub
Best Regards
enter this formula in cell B21:
=IF(AND(B20<=1.9,B20>=1),"B","")
hi, haan, solution with formula without VBA
a bit simpler
Hi Guys,
Thanks. I've figured it out...
It can be as easy as vlookup(...., ,1)
use "1" instead of "0", then it can be within the range.
Thanks.
Regards,
Haan
There are currently 1 users browsing this thread. (0 members and 1 guests)
Bookmarks