MS Office Forum / Excel / Worksheet Functions / September 2007
display 0 instead of #DIV/0!
|
|
Thread rating:  |
Chris in BKK - 11 Sep 2007 04:54 GMT I've a data gathering and calculation summary sheet in a workbook, the other sheets provide raw imput data.
The formula =SUM((B5+C5+E5+F5)*(200000/M5)) in N5 displays error #DIV/0! because M5 has a 0 valve (no problem if M5 is 1 or >). I believe IF will correct and display 0, but forget string. I left reference docs in home country.
T. Valko - 11 Sep 2007 05:03 GMT Try this:
=IF(M5=0,0,(B5+C5+E5+F5)*(200000/M5))
 Signature Biff Microsoft Excel MVP
> I've a data gathering and calculation summary sheet in a workbook, the > other [quoted text clipped - 4 lines] > correct and display 0, but forget string. I left reference docs in home > country. Chris in BKK - 11 Sep 2007 05:30 GMT Thanks guys, I got it to work by using =IF(M5="0",0,N5)+((B5+C5+E5+F5)*(200000/M5)), but I like the simpler one.
> Try this: > [quoted text clipped - 8 lines] > > correct and display 0, but forget string. I left reference docs in home > > country. David Biddulph - 11 Sep 2007 08:51 GMT I'm fascinated that you say you got it to work. I'm assuming that you've put your formula in N5, and if so you've created a circular reference, which has its own problems. You are testing for a text value of zero in M5, not for a number zero. -- David Biddulph
> Thanks guys, I got it to work by using > =IF(M5="0",0,N5)+((B5+C5+E5+F5)*(200000/M5)), but I like the simpler one.
>> Try this: >> >> =IF(M5=0,0,(B5+C5+E5+F5)*(200000/M5))
>> > I've a data gathering and calculation summary sheet in a workbook, the >> > other [quoted text clipped - 6 lines] >> > correct and display 0, but forget string. I left reference docs in home >> > country. Peo Sjoblom - 11 Sep 2007 05:06 GMT =IF(M5=0,0,(B5+C5+E5+F5)*(200000/M5))
 Signature Regards,
Peo Sjoblom
> I've a data gathering and calculation summary sheet in a workbook, the > other [quoted text clipped - 4 lines] > correct and display 0, but forget string. I left reference docs in home > country. Max - 11 Sep 2007 05:12 GMT Try: =IF(M5>0,SUM(B5,C5,E5:F5)*(200000/M5),0)
 Signature Max Singapore http://savefile.com/projects/236895 xdemechanik ---
> I've a data gathering and calculation summary sheet in a workbook, the other > sheets provide raw imput data. [quoted text clipped - 3 lines] > correct and display 0, but forget string. I left reference docs in home > country. Chris in BKK - 11 Sep 2007 06:02 GMT Max Your's gave a value of "true", need 0. The others worked. thanks for your help Chris
> Try: =IF(M5>0,SUM(B5,C5,E5:F5)*(200000/M5),0) > > I've a data gathering and calculation summary sheet in a workbook, the other [quoted text clipped - 4 lines] > > correct and display 0, but forget string. I left reference docs in home > > country. Max - 11 Sep 2007 07:12 GMT > Your's gave a value of "true", need 0. The others worked. Aha, but that shouldn't be. Mine should have worked just as well, if not better <g>. I've just quite exhaustively tested all 3* suggestions here against a plethora of possible inputs in the precedents (I took your posted spec that M5 wouldn't be negative). All 3 evaluated to give the same answers, except for the instance below. *actually only 2, since Biff's and Peo's are identical
My suggestion to use SUM actually gives you a slight "edge" in that should there inadvertently be any text input creeping into either B5,C5,E5 or F5, SUM will ignore it and the formula will still evaluate a meaningful result, instead of throwing a #VALUE! out due to the (B5+C5+E5+F5) part.
Anyway, pl tell me what are your values in B5,C5,E5,F5,M5 which gives the return of TRUE instead of 0 ? I couldn't replicate it here.
 Signature Max Singapore http://savefile.com/projects/236895 xdemechanik ---
Peo Sjoblom - 11 Sep 2007 14:37 GMT OTOH by keeping the operator Biff and I will know if there is a text in the cells which might throw off the result otherwise :)
Peo
>> Your's gave a value of "true", need 0. The others worked. > [quoted text clipped - 15 lines] > Anyway, pl tell me what are your values in B5,C5,E5,F5,M5 which gives the > return of TRUE instead of 0 ? I couldn't replicate it here. Max - 12 Sep 2007 02:25 GMT ah, but of course <g>
 Signature Max Singapore http://savefile.com/projects/236895 xdemechanik ---
|
|
|