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 strongm on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

DIV/0 error 1

Status
Not open for further replies.

vba317

Programmer
Mar 5, 2009
708
US
I have a formula that I am inserting in an excel 2003 spreadsheet. I am getting a DIV/0 error. I know what is happening but I don't know how to fix it. E is 0 in the line that is giving me an issue. So I would like to test for either D or E being 0. I do know how to do if statements, just not if statements within a formula. I would be thankful for any help.

Tom

Code:
If iColCnt = 5 Then ActiveSheet.Cells(iBRow - 1, iColCnt + 1).Formula = _
"=if(D" & iTRow & "=0,0,E" & iTRow & "/D" & iTRow & ")"
 
I don't see any problem in your formula ...

Hope This Helps, PH.
FAQ219-2884
FAQ181-2886
 
Thanks VulcanJedi that worked perfectly!!
 
I still don't understand why you want to test E as the denominator is D ...
 
I was getting the DIV/0 error if some cases because E was blank and in some cases because D was blank.
 
I dont really get this as PHV says as well as you seem to have a related thread where all these themes have come up.
I also think you would really be using ISEMPTY and/or isNULL and checking for 0s.
 
I originally did use ISEMPTY but I wasn't sure how to add the OR condition into the ISEMPTY code . The formula in this example is one of 9 different formulas used on this spreadsheet. The formula is based on monthly and yearly information from a table in access. So depending on the year and month sometimes E or D might be blank.
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top