combine multiple "if" statements

FROGGER24

Well-known Member
Joined
May 22, 2004
Messages
704
Office Version
  1. 2013
  2. 2010
Platform
  1. Windows
I need some help in combining the following formulas:
1). =IF(C2="aaaaa",((B2-A2)*24)-0.5)
2). =if((C2="bbbbb","cccccc",((B2-A2)*24)-4))
3. if none of the previous conditions exist then use this formula.. ((B2-A2)*24)-3).

Once again thanks for any help.
 

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

JoeMo

MrExcel MVP
Joined
May 26, 2009
Messages
18,144
Office Version
  1. 365
  2. 2010
Platform
  1. Windows
If none of the previous conditions exist it can either be:

((B2-A2)*24)-4

OR

((B2-A2)*24)-3

But not both.
 
Upvote 0

FROGGER24

Well-known Member
Joined
May 22, 2004
Messages
704
Office Version
  1. 2013
  2. 2010
Platform
  1. Windows
Joe, thanks for your reply. If conditions A,B or C does not exist then conditon D will be ((B2-A2)*24)-3

The formula is looking at product streams that we load. Each stream takes various amount of time to perform a task.
Condition A will deduct .5 hrs
Conditions B and C will deduct 4 hrs
Condition D I need to deduct 3 hrs
 
Upvote 0

JoeMo

MrExcel MVP
Joined
May 26, 2009
Messages
18,144
Office Version
  1. 365
  2. 2010
Platform
  1. Windows
Joe, thanks for your reply. If conditions A,B or C does not exist then conditon D will be ((B2-A2)*24)-3

The formula is looking at product streams that we load. Each stream takes various amount of time to perform a task.
Condition A will deduct .5 hrs
Conditions B and C will deduct 4 hrs
Condition D I need to deduct 3 hrs
Maybe you mean if C2 = "bbbbb" OR "cccccc" That's one condition not two. In that case try:
Code:
=IF(C2="aaaaa",((B2-A2)*24)-0.5,IF(OR(C2="bbbbb",C2="cccccc"),(B2-A2)*24-4,(B2-A2)*24-3))
 
Upvote 0

ukmikeb

Well-known Member
Joined
Jul 10, 2009
Messages
2,757
Hi

Or :-
Code:
=(B2-A2)*24-IF(C2="aaaaa",0.5,IF(OR(C2={"bbbbb","cccccc"}),4,3))

hth
 
Upvote 0

FROGGER24

Well-known Member
Joined
May 22, 2004
Messages
704
Office Version
  1. 2013
  2. 2010
Platform
  1. Windows
Joe and Mike,
Thanks for your formulas they both worked in my limited testing that I did... thanks a bunch.
 
Upvote 0

Forum statistics

Threads
1,195,924
Messages
6,012,324
Members
441,690
Latest member
CyberWrek

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