if cell is not blank, that run formula

Trevor3007

Well-known Member
Joined
Jan 26, 2017
Messages
675
Office Version
  1. 365
Platform
  1. Windows
Morning etc,
I use the following formula,:-
=MOD(F33-E33,1)-D33

however if the retrospective cell is empty(f33), it displays ####, is there a formula that will not display #### ?

Thank you.
 

Excel Facts

Back into an answer in Excel
Use Data, What-If Analysis, Goal Seek to find the correct input cell value to reach a desired result
try
Excel Formula:
=IF(F33="","",MOD(F33-E33,1)-D33)
If cell F33 is empty then the formula will return blank, otherwise will execute the MOD formula.

of
Excel Formula:
=IFERROR(MOD(F33-E33,1)-D33,"")
If your MOD formula evaluates to an error, IfError will return blank.

hth...
 
Upvote 0
try
Excel Formula:
=IF(F33="","",MOD(F33-E33,1)-D33)
If cell F33 is empty then the formula will return blank, otherwise will execute the MOD formula.

of
Excel Formula:
=IFERROR(MOD(F33-E33,1)-D33,"")
If your MOD formula evaluates to an error, IfError will return blank.

hth...
many thanks fadee2,
(and my apologies for giving you incorrect cell ref).

it works to fault... being when the applicable are not blank, the calculation is incorrect . I have to enter the times using 24hr format:-

e33 = start time = 18:00
f33 = end time= 02:00
d33 = break time = 0:30
c33 = hours worked = 7:30
using the =MOD(F33-E33,1)-D33 formula in c33, it returns the correct calculation of 7:30

but using the one you supplied ( amending to the correct cell ref) it returns 15:30. Please screenshot below. (note that d33 is a hidden column & why its not displayed below)

many thanks fadee2,
(and my apologies for giving you incorrect cell ref).

it works to fault... being when the applicable are not blank, the calculation is incorrect . I have to enter the times using 24hr format:-

e33 = start time = 18:00
f33 = end time= 02:00
d33 = break time = 0:30
c33 = hours worked = 7:30
using the =MOD(F33-E33,1)-D33 formula in c33, it returns the correct calculation of 7:30

but using the one you supplied ( amending to the correct cell ref) it returns 15:30. Please screenshot below.

View attachment 41960

Hoping you can sort? Thanks a bunch anyhoo & much appreciate your help.
 
Upvote 0
Both the formulae supplied by fadee2 work for me
+Fluff 1.xlsm
BCDEF
3307:30:0007:30:0000:3018:0002:00
Main
Cell Formulas
RangeFormula
B33B33=IFERROR(MOD(F33-E33,1)-D33,"")
C33C33=IF(F33="","",MOD(F33-E33,1)-D33)
 
Upvote 0
Both the formulae supplied by fadee2 work for me
+Fluff 1.xlsm
BCDEF
3307:30:0007:30:0000:3018:0002:00
Main
Cell Formulas
RangeFormula
B33B33=IFERROR(MOD(F33-E33,1)-D33,"")
C33C33=IF(F33="","",MOD(F33-E33,1)-D33)
Thanks Fluff ,
I think there was a prob with the actual spread sheet , which I added fadee2's into. I started with new spreadsheet & it worked ....but
1625164989006.png



I have been trying to sort myself but cannot. Can you assist?

many thanks Fluff.
 
Upvote 0
Can you post some sample data.

MrExcel has a tool called “XL2BB” that lets you post samples of your data that will allow us to copy/paste it to our Excel spreadsheets, so we can work with the same copy of data that you are. Instructions on using this tool can be found here: XL2BB Add-in

Note that there is also a "Test Here” forum on this board. This is a place where you can test using this tool (or any other posting techniques that you want to test) before trying to use those tools in your actual posts.

Also please update your profile to show what version of Excel you are using.
 
Upvote 0
Can you post some sample data.

MrExcel has a tool called “XL2BB” that lets you post samples of your data that will allow us to copy/paste it to our Excel spreadsheets, so we can work with the same copy of data that you are. Instructions on using this tool can be found here: XL2BB Add-in

Note that there is also a "Test Here” forum on this board. This is a place where you can test using this tool (or any other posting techniques that you want to test) before trying to use those tools in your actual posts.

Also please update your profile to show what version of Excel you are using.
many thanks fluff,

time calc.xlsx
ABCDEF
1
2DateDayHours WorkedStart TimeFinish TimeBreak
3
412-JulMonday07:3018:0002:0000:30
513-JulTuesday07:3009:0017:0000:30
614-JulWednesday07:3018:0002:0000:30
715-JulThursday07:3009:0017:0000:30
816-JulFriday07:3018:0002:0000:30
917-JulSaturday07:3009:0017:0000:30
1018-JulSunday07:3018:0002:0000:30
11TOTALS2.19
12Additional Hours Worked-35.11
time calc
Cell Formulas
RangeFormula
B4:B10B4=TEXT(A4, "dddd")
A5:A10A5=SUM(A4)+1
C4:C10C4=IF(E4="","",MOD(E4-D4,1)-F4)
C11C11=SUM(C4:C10)
C12C12=SUM(C11)-37.3
 
Upvote 0
Ok, change the format of C11 to [h]:mm and in C12 use
Excel Formula:
=C11*24-37.3
 
Upvote 0
Solution
try
Excel Formula:
=IF(F33="","",MOD(F33-E33,1)-D33)
If cell F33 is empty then the formula will return blank, otherwise will execute the MOD formula.

of
Excel Formula:
=IFERROR(MOD(F33-E33,1)-D33,"")
If your MOD formula evaluates to an error, IfError will return blank.

hth...
Hi Fadee2,

sorry for the late reply. Just wanted thank you for your help.
 
Upvote 0

Forum statistics

Threads
1,226,466
Messages
6,191,188
Members
453,646
Latest member
BOUCHOUATA

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