IF Problem

aivoryuk

Board Regular
Joined
Nov 18, 2009
Messages
130
Hi

I have the following problem
=IF(ISBLANK(F11),0,LOOKUP(F11,{"H","M","L"},{1000,500,0}))

The problem I have that when if the cell (f11) has a L is returns 1000 instead of 0. it works fine if the value is H or M.

Where is it going wrong?
 

Excel Facts

What did Pito Salas invent?
Pito Salas, working for Lotus, popularized what would become to be pivot tables. It was released as Lotus Improv in 1989.

VoG

Legend
Joined
Jun 19, 2002
Messages
63,650
Hi. Try (alphabetical order)

=IF(ISBLANK(F11),0,LOOKUP(F11,{"H","L","M"},{1000,0,500}))
 

aivoryuk

Board Regular
Joined
Nov 18, 2009
Messages
130
Hi that worked thanks.

Is there a particular reason it works in alphabetical order
 

VoG

Legend
Joined
Jun 19, 2002
Messages
63,650
Lookup expects the values in the first {} to be sorted ascending (=alphabetical for text).
 

T. Valko

Well-known Member
Joined
May 9, 2009
Messages
16,623
Hi

I have the following problem
=IF(ISBLANK(F11),0,LOOKUP(F11,{"H","M","L"},{1000,500,0}))

The problem I have that when if the cell (f11) has a L is returns 1000 instead of 0. it works fine if the value is H or M.

Where is it going wrong?
The lookup_array *must* be sorted in ascending order.

Assuming that the only possible entries are an empty cell, H, L or M, here's another way to do it:

=IF(OR(F11={"","L"}),0,IF(F11="H",1000,500))
 

Watch MrExcel Video

Forum statistics

Threads
1,129,752
Messages
5,638,162
Members
417,011
Latest member
Amaden95

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