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!
 

Some videos you may like

Excel Facts

Select all contiguous cells
Pressing Ctrl+* (asterisk) will select the "current region" - all contiguous cells in all directions.

Mark W.

MrExcel MVP
Joined
Feb 10, 2002
Messages
11,654
=IF(E19-D19>8,"oss",E19-D19)

Not really sure if I understand your request. What's in E19 and D19?
 

Brian from Maui

MrExcel MVP
Joined
Feb 16, 2002
Messages
8,458
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
 

Mark W.

MrExcel MVP
Joined
Feb 10, 2002
Messages
11,654

ADVERTISEMENT

blairkropp said:
e19 and d19 were the example cell numbers.

Right. But, what do they contain?
 

blairkropp

New Member
Joined
Feb 18, 2005
Messages
22

ADVERTISEMENT

they contain times in military time
 

blairkropp

New Member
Joined
Feb 18, 2005
Messages
22
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?
 

Brian from Maui

MrExcel MVP
Joined
Feb 16, 2002
Messages
8,458
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.
 

Watch MrExcel Video

Forum statistics

Threads
1,122,795
Messages
5,598,083
Members
414,210
Latest member
Janisogor

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
Top