IF FUNCTION

mmwater

New Member
Joined
Sep 25, 2005
Messages
14
Hi,

Is there a way to use ' IF ' function to make a formula with three (or more) possible outcomes ? e.g. -

IF cell A1 = E B1 = $19 or
IF cell A1 = F B1 = $22 or
IF cell A1 = G B1 = $25

Or is there another function in excel where I can achieve something like the above ?

Thanks,
Wendy
 

Excel Facts

Which came first: VisiCalc or Lotus 1-2-3?
Dan Bricklin and Bob Frankston debuted VisiCalc in 1979 as a Visible Calculator. Lotus 1-2-3 debuted in the early 1980's, from Mitch Kapor.

pgc01

MrExcel MVP
Joined
Apr 25, 2006
Messages
19,887
Hi Wendy

One solution:

In B1:

=IF(A1="E",19, IF(A1 = "F", 22,IF(A1 = "G",25,"A1 not valid")))

If you have many options you can also use Vlookup.

Hope this helps
PGC
 

Aladin Akyurek

MrExcel MVP
Joined
Feb 14, 2002
Messages
85,210
Hi,

Is there a way to use ' IF ' function to make a formula with three (or more) possible outcomes ? e.g. -

IF cell A1 = E B1 = $19 or
IF cell A1 = F B1 = $22 or
IF cell A1 = G B1 = $25

Or is there another function in excel where I can achieve something like the above ?

Thanks,
Wendy

Create a 2-column table on a different sheet named, say, Admin, which associates letters with figures. Name the table AMOUNTS. Then invoke:

=VLOOKUP(A1,AMOUNTS,2,0)

If the table of associations is fixed and short, invoke:

=VLOOKUP(A1,{"E",19;"F",22;"G",25},2,0)
 

Norie

Well-known Member
Joined
Apr 28, 2004
Messages
76,351
Office Version
  1. 365
Platform
  1. Windows
Wendy

This also might work, but I'm sure it's probably inefficient and wrong.:)

="$"&19+(CODE(A1)-CODE("E"))*3

By the way it will return a text value rather than a number.

Oh, and it does include the $.:)
 

mmwater

New Member
Joined
Sep 25, 2005
Messages
14
Thanks for your suggestions - I will give them a try to see what works
Regards
Wendy
 

Forum statistics

Threads
1,171,463
Messages
5,875,658
Members
433,145
Latest member
nzltrippa

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