IF forumla

timcbaker

New Member
Joined
Jan 12, 2018
Messages
8
Hi,

I have the current formula in cell M14:
=-IF(SUM($M$8>B14),SUM($M$8-B14),0)

However, I only want it to work if there is a value in cell B14

If cell B14 is blank I want cell M14 to show 00:00 (Its a time formula).

Can anyone help?

Thanks,
Tim
 

Excel Facts

Copy PDF to Excel
Select data in PDF. Paste to Microsoft Word. Copy from Word and paste to Excel.
Hi, welcome to the board.

First, you can simplify your existing formula quite alot, like this

=IF($M$8>B14,$M$8-B14,0)

And perhaps even further, like this

=MAX($M$8-B14,0)

If you want to force a 0 in M14 if B14 is zero, perhaps

=IF(B14=0,0,MAX($M$8-B14,0))
 
Upvote 0
Something like:

=IF(ISNUMBER(B14),-M8+B14,"") or change "" to 0 (zero)

Will test B14 to insure it is a valid number (positive or negative)..

Format Cell M14 as time (00:00)

Hope that helps
 
Last edited:
Upvote 0
That's great - thanks guys !

Okay, next one..

=-IF(SUM($O$8>E15),SUM($O$8-E15),0)

I only want this calculating if there is an entry in cell B15
 
Upvote 0
You are not using the SUM function correctly.
You use it when summing up a whole range of cells, i.e.
Code:
=SUM(A1:A10)
It literally says "add up all the cells in the range).

So you would not use it on a single cell, or wrap other formula on single cells.
You can essentially remove them from all the formulas you have posted in this thread.

Okay, next one..

=-IF(SUM($O$8>E15),SUM($O$8-E15),0)

I only want this calculating if there is an entry in cell B15
Try:
Code:
=IF(B15<>"",MAX($O$8-E15,0),"")

Based on your two questions, hopefully, you can see the pattern here now.
 
Last edited:
Upvote 0
Thanks
what if I want to amend this slightly.
If there is value in cell G15 and/or H15 I don't want the formula to calculate and just show 00:00 ?
 
Upvote 0
I think 'or' would work on this occasion
OK. Take a crack at it and see how you do, and post back if you run into issues.
That way we can see if we are really helping you understand and learning how to do these (instead of simply doing them all for you).
 
Upvote 0

Forum statistics

Threads
1,223,911
Messages
6,175,333
Members
452,636
Latest member
laura12345

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