![]() |
![]() |
|
|||||||
| Excel Questions All Excel/VBA questions - formulas, macros, pivot tables, general help, etc. Please post to this forum in English only. |
![]() |
|
|
Thread Tools | Display Modes |
|
|
#1 |
|
Board Regular
Join Date: May 2002
Posts: 66
|
Brain numb...need help.
I have used a formula to get information from two cells (one is inputs, the other is hours worked) and display the average amount in a third cell. However, until data is entered into both the input and hours worked cells, the third cell keeps showing a #DIV/0 error message. Can i get rid of this by customising the format of the third cell? Many thanks G |
|
|
|
|
|
#2 | |
|
Board Regular
Join Date: Feb 2002
Posts: 74
|
Quote:
Instead of =A1/B1 sue =IF(B1=0,0,A1/B1) HTH
__________________
"Interfere? Of course we should interfere! Always do what you're best at, that's what I say!" -- The Doctor, Nightmare of Eden |
|
|
|
|
|
|
#3 |
|
Board Regular
Join Date: Feb 2002
Location: Southfield,MI USA
Posts: 1,027
|
Hey,
You might want to tweak your formula a bit to bypass the errors. For example instead of: =B2/C2 Use: =IF(C2=0,"",B2/C2) or alternatively: =IF(ISERROR(B2/C2),"",B2/C2) Adam |
|
|
|
|
|
#4 |
|
MrExcel MVP
Join Date: Feb 2002
Location: Sydney, Australia
Posts: 2,908
|
Try something like this:-
=IF(A1=0,0,B1/A1) If the value in the denominator (A1) is 0 then return 0, otherwise return B1/A1. HTH, Dan |
|
|
|
|
|
#5 |
|
Board Regular
Join Date: Apr 2002
Posts: 66
|
Here's a macro I use all the time to easily convert formulas to prevent DIV/0 and other error messages. Just highlight the cell or cells you want to covert and ru the macro:
Sub IFISERROR() ' Dim FormulaChanged As String For Each cell In Selection FormulaChanged = Mid(cell.Formula, 2) FormulaChanged = "=IF(ISERROR(" & FormulaChanged & "),""""," & FormulaChanged & _ ")" cell.Formula = FormulaChanged Next cell End Sub |
|
|
|
|
|
#6 |
|
Board Regular
Join Date: May 2002
Posts: 66
|
Guys,
Many many thanks for your help...the formula correction worked! Appreciate your help guys. G |
|
|
|
![]() |
| Bookmarks |
| Thread Tools | |
| Display Modes | |
|
|