# Multiple IF's in formula's.

#### Flash0220

##### Board Regular
Hello,

I'm having the following problem

I have a worksheet with the following columns

Column B contains a date entered by the user.

Column C contains a numerical code.

Column D needs to have a formula which does the following.
If the code in column C (on the same row) equals 20, then
a certain formula has to be executed.
If the code in column C is NOT 20 another formula has to
be executed.
No problems so far. Column E needs to have a formula which does the following.
If the code in column C is 11, 12, 13, 14 or 20 then a
certain formula has to be executed.
If the code in column C is NOT 11, 12, 13, 14 or 20 then
another formula has to be executed.
Both of these formula's are "IF" formula's
(If "condition = ---- then do this if not then do that)

What formula('s) can I use to do this ?

In the future I would like to use VBA for this, but for
the time being this (unfortunately) has to be done
using formula's only.

For the VBA version I would like to use "Case"

For example :

Case = 20
Calculate the values in columns D and E.
Case = 30
Calculate the values in columns D and E.
(And so on, and on, and on....)

Or are there better ways to do this ?

And now my final (stupid ?) question ?
Is it possible to "integrate" a formula in VBA ?

Something like this ?
SomeVariable = SUM(A10 + 20)

I would be very gratefull, if anyone could answer these questions.

Thanks,
Frits Jager
(The Netherlands)

### Excel Facts

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

#### Andrew Poulsom

##### MrExcel MVP
For your first question something like:

=IF(OR(C1=11,C1=12,C1=13,C1=14,C1=20),"FormulaIfTrue","FormulaIfFalse")

SomeVariable = WorksheetFunction.Sum(Worksheets("Sheet1").Range("A10").Value, 20)

#### Flash0220

##### Board Regular
Hello,

Best regards,

Frits Jager
(The Netherlands)

Replies
8
Views
192
Replies
2
Views
118
Replies
3
Views
50
Replies
2
Views
91
Replies
5
Views
182

### Forum statistics

1,136,575
Messages
5,676,645
Members
419,637
Latest member
jwazza343 ### 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