ExcelBanter

ExcelBanter (https://www.excelbanter.com/)
-   Excel Programming (https://www.excelbanter.com/excel-programming/)
-   -   formula to code help (https://www.excelbanter.com/excel-programming/292883-formula-code-help.html)

JohnE

formula to code help
 
I have the following formula that I was able to do. But I
prefer to put this into code and attach it to a button
that has several other events to it. But since I am
having a brain freeze, can not figure out how to put this
into code. Can someone get me started correctly? Is
there a website to go to for tips and tricks?

=SUM(Detail!$G$2:$G$60000,(IF(Detail!$K$2:$K$60000 =1998,IF
(Detail!$M$2:$M$60000="LB",IF(Detail!$J$2:$J$60000 ="Bodily
Injury",IF(Detail!$G$2:$G$60000="Open",1,0))))))

Thanks to anyone who responds.
*** John

Bob Phillips[_6_]

formula to code help
 
Why?

If it works, a worksheet function is usually better than VBA.

--

HTH

Bob Phillips
... looking out across Poole Harbour to the Purbecks
(remove nothere from the email address if mailing direct)

"JohnE" wrote in message
...
I have the following formula that I was able to do. But I
prefer to put this into code and attach it to a button
that has several other events to it. But since I am
having a brain freeze, can not figure out how to put this
into code. Can someone get me started correctly? Is
there a website to go to for tips and tricks?

=SUM(Detail!$G$2:$G$60000,(IF(Detail!$K$2:$K$60000 =1998,IF
(Detail!$M$2:$M$60000="LB",IF(Detail!$J$2:$J$60000 ="Bodily
Injury",IF(Detail!$G$2:$G$60000="Open",1,0))))))

Thanks to anyone who responds.
*** John




Vasant Nanavati

formula to code help
 
Range("A1").Formula =
"=SUM(Detail!R2C7:R60000C7,(IF(Detail!R2C11:R60000 C11=1998,IF(Detail!R2C13:R
60000C13=""LB"",IF(Detail!R2C10:R60000C10=""Bodily
Injury"",IF(Detail!R2C7:R60000C7=""Open"",1,0))))) )"

Watch the line wrap.

--

Vasant



"JohnE" wrote in message
...
I have the following formula that I was able to do. But I
prefer to put this into code and attach it to a button
that has several other events to it. But since I am
having a brain freeze, can not figure out how to put this
into code. Can someone get me started correctly? Is
there a website to go to for tips and tricks?

=SUM(Detail!$G$2:$G$60000,(IF(Detail!$K$2:$K$60000 =1998,IF
(Detail!$M$2:$M$60000="LB",IF(Detail!$J$2:$J$60000 ="Bodily
Injury",IF(Detail!$G$2:$G$60000="Open",1,0))))))

Thanks to anyone who responds.
*** John





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

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