ExcelBanter

ExcelBanter (https://www.excelbanter.com/)
-   Excel Programming (https://www.excelbanter.com/excel-programming/)
-   -   VBA for comparing data within a range for Excel 2003 (https://www.excelbanter.com/excel-programming/437844-re-vba-comparing-data-within-range-excel-2003-a.html)

marcus[_3_]

VBA for comparing data within a range for Excel 2003
 
Hi

You don't need vba to solve this one. A formula will work just as
well. Put this in the appropriate cell and drag it down.

=IF(ISBLANK(D2),"",IF((AND((D2<B2),(C2<A2))),"Uptr end","Downtrend"))

VBA will do the job if you do not want to drag your formula to the
bottom of the range each time.

Take care

Marcus

Sub Fill()
Dim lw As Integer

lw = Range("D" & Rows.Count).End(xlUp).Row
Range("E2").AutoFill Range("E2:E" & lw)
End Sub

jmberner

VBA for comparing data within a range for Excel 2003
 
Thanks Marcus,

The formula would work, but the problem is that appearance of a value in
column AD is completely random, so using the IF(AND(D2<B2),(C2<A2) does not
work accurately.

Jeff

"marcus" wrote:

Hi

You don't need vba to solve this one. A formula will work just as
well. Put this in the appropriate cell and drag it down.

=IF(ISBLANK(D2),"",IF((AND((D2<B2),(C2<A2))),"Uptr end","Downtrend"))

VBA will do the job if you do not want to drag your formula to the
bottom of the range each time.

Take care

Marcus

Sub Fill()
Dim lw As Integer

lw = Range("D" & Rows.Count).End(xlUp).Row
Range("E2").AutoFill Range("E2:E" & lw)
End Sub
.



All times are GMT +1. The time now is 08:55 PM.

Powered by vBulletin® Copyright ©2000 - 2024, Jelsoft Enterprises Ltd.
ExcelBanter.com