#DIV/0! error

mwvirk

Active Member
Joined
Mar 2, 2011
Messages
286
Office Version
  1. 2016
Platform
  1. Windows
the entire row is working fine and I just noticed that if there is no value in C then G J K are giving #DIV/0! error
is there a way to fix it without changing other formulas? but of course, if you can correct my existing formulas, I will be more than happy for your support.
thank you.


1725049133512.png


MWVirk PSX Portfolio v0004.xlsx
ABCDEFGHIJKLMNOPQR
12419-Sep-2024MARI0101340.00%0.00#DIV/0!15.00%0.00#DIV/0!#DIV/0!0.00No800.00%0No
PSX Payouts Status
Cell Formulas
RangeFormula
C124C124=IF(B124="","",SUMIFS('PSX Trading'!G:G,'PSX Trading'!A:A,B124,'PSX Trading'!C:C,"<>Closed",'PSX Trading'!F:F,"<"&A124) + SUMIFS('PSX Trading'!G:G,'PSX Trading'!A:A,B124,'PSX Trading'!C:C,"Closed",'PSX Trading'!AD:AD,">="&A124,'PSX Trading'!F:F,"<"&A124))
D124D124=IFERROR(VLOOKUP(B124,'PSX Shopping List'!A:CD,2,0),"")
F124F124=IF(AND(C124<>"",E124<>""),((C124*E124)*D124),"")
G124G124=IF(AND(C124<>"",F124<>""),F124/C124,"")
H124H124=IF(E124="","",IF((ISNUMBER(FIND("SPWL",B124))+ISNUMBER(FIND("KOHE",B124))+ISNUMBER(FIND("HUBC",B124)))>0,0.075,0.15))
I124I124=IF(AND(F124<>"",H124<>""),F124*H124,"")
J124J124=IF(AND(G124<>"",K124<>""),G124-K124,"")
K124K124=IF(AND(C124<>"",L124<>""),L124/C124,"")
L124L124=IF(AND(F124<>"",I124<>""),F124-I124,"")
P124P124=IF(AND(C124<>"",O124<>""),TRUNC(C124*O124*IF(A124>=DATE(2023,7,1),0.9,1)),"")
Named Ranges
NameRefers ToCells
'PSX Shopping List'!_FilterDatabase='PSX Shopping List'!$A$1:$CC$1D124
'PSX Trading'!_FilterDatabase='PSX Trading'!$A$1:$BV$1201C124
Cells with Conditional Formatting
CellConditionCell FormatStop If True
O2:P1200,R2:R1200Expression=AND($R2<>"",$O2<>"")textNO
O2:P1200,R2:R1200Expression=$O2<>""textNO
H2:H1200Cellcontains a blank value textNO
H2:H1200Cell Value<>0.15textNO
E2:H1200,J2:K1200,N2:N1200Expression=AND($N2<>"",$E2<>"")textNO
E2:H1200,J2:K1200,N2:N1200Expression=$E2<>""textNO
B2:B1200Expression=OR("SPWL"=B2,"KOHE"=B2,"HUBC"=B2)textNO
D2:D1200Cell Value<>10textNO
M2:M1200Cell Valuecontains "No"textNO
M2:M1200Cell Valuecontains "Yes"textNO
Q59:Q1200Cell Valuecontains "No"textNO
Q59:Q1200Cell Valuecontains "Yes"textNO
 

Excel Facts

Copy formula down without changing references
If you have =SUM(F2:F49) in F50; type Alt+' in F51 to copy =SUM(F2:F49) to F51, leaving the formula in edit mode. Change SUM to COUNT.
Test for >0, not "" ?
please mark the cell where i should change it to >0 instead of ""
Do you mean?

i tried >0 and still getting this:

1725051639384.png



MWVirk PSX Portfolio v0004.xlsx
GHIJK
124 15.00%0.00#VALUE! 
PSX Payouts Status
Cell Formulas
RangeFormula
G124G124=IF(AND($C$124>0,$F$124>0),$F$124/$C$124,"")
H124H124=IF(E124="","",IF((ISNUMBER(FIND("SPWL",B124))+ISNUMBER(FIND("KOHE",B124))+ISNUMBER(FIND("HUBC",B124)))>0,0.075,0.15))
I124I124=IF(AND(F124<>"",H124<>""),F124*H124,"")
J124J124=IF(AND(G124>0,K124>0),G124-K124,"")
K124K124=IF(AND(C124>0,L124>0),L124/C124,"")
Cells with Conditional Formatting
CellConditionCell FormatStop If True
H2:H1200Cellcontains a blank value textNO
H2:H1200Cell Value<>0.15textNO
E2:H1200,J2:K1200,N2:N1200Expression=AND($N2<>"",$E2<>"")textNO
E2:H1200,J2:K1200,N2:N1200Expression=$E2<>""textNO
 
Upvote 0
if there is no value in C
In your row 124 that is not true - there is zero:
1725053717772.png

so for where you use division, at least test the divisor for not being zero rather than testing for "" so for example
not
=IF(AND(C124<>"",F124<>""),F124/C124,"")

but
=IF(AND(C124>0,F124<>""),F124/C124,"")

Sorry if I picked the wrong formula but it looked like a good example to me. The important thing is to make sure you test the divisor for not being zero. If it can be negative then

=IF(AND(C124<>0,F124<>""),F124/C124,"")
That assumes C124 is the divisor. Not sure what you'd get if you end up dividing "" by something that <> 0. Based on that possibility, my suggestion may not be robust enough.
 
Upvote 1
Solution

Forum statistics

Threads
1,221,310
Messages
6,159,176
Members
451,543
Latest member
cesymcox

We've detected that you are using an adblocker.

We have a great community of people providing Excel help here, but the hosting costs are enormous. You can help keep this site running by allowing ads on MrExcel.com.
Allow Ads at MrExcel

Which adblocker are you using?

Disable AdBlock

Follow these easy steps to disable AdBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the icon in the browser’s toolbar.
2)Click on the "Pause on this site" option.
Go back

Disable AdBlock Plus

Follow these easy steps to disable AdBlock Plus

1)Click on the icon in the browser’s toolbar.
2)Click on the toggle to disable it for "mrexcel.com".
Go back

Disable uBlock Origin

Follow these easy steps to disable uBlock Origin

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back

Disable uBlock

Follow these easy steps to disable uBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back
Back
Top