if then statements

blairkropp

New Member
Joined
Feb 18, 2005
Messages
22
how do you do an if then statement in excel. I am trying to do if e19-d19 > 8 then = "oss" else if equals that amount. I am trying to subtract by using miliraty time. can you please help. thanks!
 

Excel Facts

Excel Joke
Why can't spreadsheets drive cars? They crash too often!
=IF(E19-D19>8,"oss",E19-D19)

Not really sure if I understand your request. What's in E19 and D19?
 
Upvote 0
blairkropp said:
how do you do an if then statement in excel. I am trying to do if e19-d19 > 8 then = "oss" else if equals that amount. I am trying to subtract by using miliraty time. can you please help. thanks!

Excel store times as fractions of a day, so 8 hours is 1/3, so....

=IF(A2-A1 > 1/3,"oss","")

or

=IF(A2-A1>"8:00"+0,"oss","")

Yor're unclear as to what happens when the time is less than or equals
 
Upvote 0
i got it to work, but if im trying to subtract 07:00 from 18:00 (they are two separate days) i am unable to do that.
any suggestions?
 
Upvote 0
blairkropp said:
i got it to work, but if im trying to subtract 07:00 from 18:00 (they are two separate days) i am unable to do that.
any suggestions?

=IF(A2-A1+(A2 < A1) > "8:00"+0,"OSS","")

ot

=IF(A2-A1+(A2 < A1) > 1/3,"OSS","")

again, you're unclear as to what happens if the time is less than or equal to 8 hours.
 
Upvote 0

Forum statistics

Threads
1,214,599
Messages
6,120,447
Members
448,966
Latest member
DannyC96

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