# combine multiple "if" statements

#### FROGGER24

##### Well-known Member
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
If none of the previous conditions exist it can either be:

((B2-A2)*24)-4

OR

((B2-A2)*24)-3

But not both.

#### FROGGER24

##### Well-known Member
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

#### JoeMo

##### MrExcel MVP
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))``

#### ukmikeb

##### Well-known Member
Hi

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

hth

#### FROGGER24

##### Well-known Member
Joe and Mike,
Thanks for your formulas they both worked in my limited testing that I did... thanks a bunch.

Replies
5
Views
105
Replies
2
Views
289
Replies
1
Views
221
Replies
5
Views
243
Replies
13
Views
213

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.

### Which adblocker are you using?

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