If, or, if, or...

joezeppy

Board Regular
Joined
Feb 7, 2005
Messages
72
I keep forgetting my syntax in Excel (don't use it enough). I know this is easy; can someone help me to do the following?

if cell a2 = "Year" then show a1 times 12, if cell a2 = "Half Year" then show a1 times 6, if cell a2 = "Quarter" then show a1 times 3, if cell a2 = "Month" then show a1.

I know this is a great place for Excel help. Thanks in advance.

Joe
 

Excel Facts

Excel Joke
Why can't spreadsheets drive cars? They crash too often!
Hi,

One option might be:
=A1 * LOOKUP(A2, {"Half Year","Month","Quarter","Year"}, {6,1,3,12})

Note that if you ever wanted to add further periods to the lookup_vector ({"Half Year","Month","Quarter","Year"}), it must be sorted in ascending order.
 
Upvote 0

Forum statistics

Threads
1,215,193
Messages
6,123,560
Members
449,108
Latest member
rache47

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
Back
Top