ExcelBanter

ExcelBanter (https://www.excelbanter.com/)
-   Excel Programming (https://www.excelbanter.com/excel-programming/)
-   -   If-Then-Else resulting in DIV/0 error (https://www.excelbanter.com/excel-programming/313062-if-then-else-resulting-div-0-error.html)

scapen

If-Then-Else resulting in DIV/0 error
 

Help Please!! :confused:

I am doing a homework assignment that requires an IF statement to b
included in my macro. My problem is my Average Salary contains
daverage function....so when my Number of Employees equals zero
average salary results in DIV/0 error message. I'm not sure how t
write my If statement to display 0 in the average salary when th
number of employees equals 0. Any help would be appreciated.

Thank you

--
scape
-----------------------------------------------------------------------
scapen's Profile: http://www.excelforum.com/member.php...fo&userid=1515
View this thread: http://www.excelforum.com/showthread.php?threadid=26789


duane[_19_]

If-Then-Else resulting in DIV/0 error
 

right before you calculate the avg

if emp = 0 then avg = 0

continue with your code
where emp = # of employees and avg = average salar

--
duan
-----------------------------------------------------------------------
duane's Profile: http://www.excelforum.com/member.php...fo&userid=1162
View this thread: http://www.excelforum.com/showthread.php?threadid=26789


Tom Ogilvy[_21_]

If-Then-Else resulting in DIV/0 error
 

You attached no file.

--
Regards,
Tom Ogilv

--
Tom Ogilv
-----------------------------------------------------------------------
Tom Ogilvy's Profile: http://www.excelforum.com/member.php...nfo&userid=196
View this thread: http://www.excelforum.com/showthread.php?threadid=26789



All times are GMT +1. The time now is 12:32 AM.

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