Multiple IF's in formula's.

Flash0220

Board Regular
Joined
May 2, 2002
Messages
104
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
Joined
Jul 21, 2002
Messages
73,092
For your first question something like:

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

For your second question:

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

Flash0220

Board Regular
Joined
May 2, 2002
Messages
104
Hello,


Thanks for your reply, this formula works perfectly !!




Best regards,

Frits Jager
(The Netherlands)
 

Forum statistics

Threads
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.
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