nigelandrewfoster

Well-known Member
I have a simple rota spreadsheet which calculates hours worked per worker MONDAY to FRIDAY by inputting START and FINISHING times for each day. It works, until the user inputs "HOLIDAY" or other text into the table, which results in "#VALUE!" in the totals box. Is there any way I can get Excel to ignore text or treat it as zero without resorting to a macro?

Excel Facts

Format cells as time
Select range and press Ctrl+Shift+2 to format cells as time. (Shift 2 is the @ sign).

bobsan42

Well-known Member
what is the formula which calculates the total?

nigelandrewfoster

Well-known Member
=(C4-B4)+(E4-D4)+(G4-F4)+(I4-H4)+(K4-J4)+(M4-L4)+(O4-N4) IN Q4, THEN =IF(Q4>0,Q4,0) IN P4 (TO SCREEN OUT NEGATIVES)
Thanks,
Nigel

bobsan42

Well-known Member
then i guess you should put an error check ot each subtraction (sorry but can't think of a more elegant way). The question is what shgould happen if there is Holiday - shoud it return 0? if yes then try this:
=if(iserror(C4-B4),0,(C4-B4))+if(iserror(E4-D4),0,(E4-D4))+if(iserror(G4-F4),0,(G4-F4))+if(iserror(I4-H4),0,(I4-H4))+if(iserror(K4-J4),0,(K4-J4))+if(iserror(M4-L4),0,(M4-L4))+if(iserror(O4-N4),0,(O4-N4))

nigelandrewfoster

Well-known Member
Thanks for that. Never used 'iserror' before. I'm sure it will be very useful in the future.

Toonies

Board Regular

If you PM me I will give you more detail.

Many Thanks

Toonies

Excel contains over 450 functions, with more added every year. That’s a huge number, so where should you start? Right here with this bundle.

1,164,389
Messages
5,836,972
Members
430,464
Latest member
nickburrett

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.

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

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