Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations Mike Lewis on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Excel Formula or Macro

Status
Not open for further replies.

luceze

Programmer
Apr 26, 2001
842
US
I don't even know if Excel 2000 can do this, but I would like help with a formula or macro that would calculate if fields in a data series are successively getting larger. For example B1 cannot be smaller than A1, C1 cannot be smaller than B1. I know that I can check this with validation but I would like a field that displayed something if this criteria is not met. Here is an example of some data.

0 0 0 1000 2000 3000
0 0 0 0 3500 4000

I know that I have to test the 0 fields because they are not larger than each other, but I don't know where to go from there. Thanks in advance for any help.
 
Create another range that checks for the condidtion

=IF(B1>=A1,"","Error")

Copy this formula to match all values in table #1
 
I tried this formula but it doesn't work.

=IF(Z1>=Y1>=X1>=W1>=V1>=U1>=T1>=S1>=R1>=Q1>=P1>=O1>=N1>=M1>=L1>=K1>=J1>=I1>=H1>=G1>=F1>=D1>=C1>=B1>=A1,"x ","!!!!")
 
If you want to use VB then insert this into a module on the workbook.

Public Function GettingBigger(MyRange As Range)
Dim c As Object
Dim PrevValue As Long
Dim Higher As Boolean

Higher = True
PrevValue = 0

For Each c In MyRange
If c.Value < PrevValue Then Higher = False
PrevValue = c.Value
Next

GettingBigger = Higher
End Function

Then goto insert-function choose &quot;user defined&quot; then select GettingBigger.

then select your range.

Syntax:

=GettingBigger(A1:F1)

This function will return true if values get bigger and False if they don't.
 
Darksun,

That worked great!! Thanks for your help.
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top