If(and) statements used with calculations

jay-excel

New Member
Joined
Aug 20, 2009
Messages
34
Hello,<?xml:namespace prefix = o ns = "urn:schemas-microsoft-com:office:office" /><o:p></o:p>
<o:p></o:p>
I have an IF(AND... Statement that when FALSE, returns a blank cell. <o:p></o:p>
<o:p></o:p>
The trouble I am experiencing is using the cell with the IF(AND... statement in reference in a mathematical formula in another cell.<o:p></o:p>
<o:p></o:p>
Firstly, I want D17 to be blank if the condition is not met. =IF(AND(D12="yes",G12>0),G12,"")<o:p></o:p>
<o:p></o:p>
I want H16 to remain "0" if there is no math to do<o:p></o:p>
=(D17*E17)+(D18*E18)<o:p></o:p>
<o:p></o:p>
<o:p></o:p>
Currently the setup is:<o:p></o:p>
<o:p></o:p>
D17 --> =IF(AND(D12="yes",G12>0),G12,"")<o:p></o:p>
<o:p></o:p>
H16 --> =(D17*E17)+(D18*E18)<o:p></o:p>
<o:p></o:p>
If D17 is FALSE (displayed as a blank cell) then H16 returns "#VALUE"<o:p></o:p>
<o:p></o:p>
Is there a way to have D17 remain blank when D12 and G12 don't meet the condition and H16 continue to calculate the totals?<o:p></o:p>
<o:p></o:p>
<o:p></o:p>
Am open to all suggestions, even those that are vastly different from what I have attempted. <o:p></o:p>
<o:p></o:p>
Cheers<o:p></o:p>
<o:p></o:p>
- Jay<o:p></o:p>
<o:p></o:p>
 

Excel Facts

Best way to learn Power Query?
Read M is for (Data) Monkey book by Ken Puls and Miguel Escobar. It is the complete guide to Power Query.
Hmmm. Try custom formats. There are some guides online I will see if I can get some half baked format back to you soon.
 
Upvote 0
Use a custom format. This should do the trick. Post the whole line into the custom format line.

0.00;0.00;""

this will display numbers from positive to negative to zero

123.45 -123,45

As you can see nothing will be displayed for a value of zero, but the value will remain.
 
Upvote 0
Hello,

I tried changing the cell format to custom with your suggestion but was unsuccessful. The H16 cell still displays "#VALUE" when D17 is blank
 
Upvote 0
Hi,

Sorry, you were right. It works graet, I had forgotten to correct the formula from

=IF(AND(D12="yes",G12>0),G12,"")


to

=IF(AND(D12="yes",G12>0),G12,)
 
Upvote 0

Forum statistics

Threads
1,224,828
Messages
6,181,215
Members
453,024
Latest member
Wingit77

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