ExcelBanter

ExcelBanter (https://www.excelbanter.com/)
-   Excel Programming (https://www.excelbanter.com/excel-programming/)
-   -   new formula after condition met (https://www.excelbanter.com/excel-programming/402997-new-formula-after-condition-met.html)

Vincent

new formula after condition met
 
First of all, Merry Christmas to everyone

I´ll Try to explain my problem with an example.

I use this simple formula down the column E to solve my problem (TEMPORARILY):

E10 =IF(D10-D$1=245;"OIL CHANGE";"")

After condition met i have to change that formula manually.
Assuming that D19-D1=249, I will have to insert
in cell E20 =IF(D20-D$19=245;"OIL CHANGE";"")

So, AFTER each oil change, i need to CHANGE the locked cell. I guess i need
a macro for this one, but then again maybe not :)

Thanks everyone




Don Guillett

new formula after condition met
 
I'm not quite sure if you meant d1 or d9 in your example but something like
this should help. Probably need to change my , to your ;

Sub doformulas()
For i = 10 To 40 Step 10
ms = "if(d" & i & "-d" & i - 1 & "=245,""oil "","""")"
Cells(i, "e").Formula = "=" & ms & ""
Next i
End Sub
'=IF(D10-D$1=245;"OIL CHANGE";"")
' IF(D20-D$19=245;"


--
Don Guillett
Microsoft MVP Excel
SalesAid Software

"Vincent" wrote in message
...
First of all, Merry Christmas to everyone

I´ll Try to explain my problem with an example.

I use this simple formula down the column E to solve my problem
(TEMPORARILY):

E10 =IF(D10-D$1=245;"OIL CHANGE";"")

After condition met i have to change that formula manually.
Assuming that D19-D1=249, I will have to insert
in cell E20 =IF(D20-D$19=245;"OIL CHANGE";"")

So, AFTER each oil change, i need to CHANGE the locked cell. I guess i
need
a macro for this one, but then again maybe not :)

Thanks everyone





Carim[_2_]

new formula after condition met
 
Salut Vincent,

As long as you type in cell E1 "OIL CHANGE" ...
you can use starting in cell E2 the following formula ...

=IF(AND((D2-(INDIRECT(ADDRESS(SUMPRODUCT(MAX((ROW($E$1:E1))*($ E$1:E1=$E
$1))),4,2)))=245),E1=""),"OIL CHANGE","")

HTH


All times are GMT +1. The time now is 06:39 AM.

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