VBA Statement

  • Thread starter Thread starter Frank
  • Start date Start date
F

Frank

I have a worksheet with 12 months. Some cells are in the
negative. What I would like to do with a VBA statement is
to go to another cell and if any month is equal to less
than zero put in OVER, else actual data.

Example:
J F M A M J J A S O N D
-1 2 3 -5 4 6 -8 9 10 -2 3 -8

= over

Thanks
Frank
 
Frank,

Use an equation in the other cell.

=IF(Cell Value <0,"Over",Cell Value)

So,
If your months are in cells A1 to L1
and your data is in cells A2 to L2
and your equations are in cells A3 to L3
Then cell A3 would contain =IF(A2<0,"Over",A2)

Put the equation in cell A3 and copy it to the other cells B3 to L3.

You get:

F M A M J J A S O N
D
2 3 -5 4 6 -8 9 10 -2
3 -8
2 3 Over 4 6 Over 9 10 Over 3
Over


Ken
 
Back
Top