IF question

frepez

New Member
Joined
Sep 28, 2006
Messages
1
FreddieP wrote:
Hi I have in a row 3 different values that I want to compare with a specific
value on the same row. It looks like below

A B C D
10 20 30 22

If D is higher than B I want it to return B if is lower I want it to return
A. So far so good, this I can do but if it looks like below and b & c are
empty, I cant get it to return, A it just returna a blank.

A B C D
10 22

This is the formula I used.

=IF(S2>Z2;Z2;IF(S2>Y2;Y2;X2))

I'ts kind of hard to explain what I mean, I hope someone understands my
question :)

I have tried HLOOKUP but I couldn't get it to work.

/Freddie
 

Excel Facts

Excel Can Read to You
Customize Quick Access Toolbar. From All Commands, add Speak Cells or Speak Cells on Enter to QAT. Select cells. Press Speak Cells.

lozzablake

Well-known Member
Joined
Dec 15, 2005
Messages
818
assuming XYZ=A,B,C and S is D then in your first statement you have:

S2>Z2 as Z is blank S is greater than a blank and so it returns Z2. If you wanit to ignore blanks you need to use an AND statement so the formula knows to ignore blanks eg:

IF(AND(S2>Z2,Z2<>""),Z2,more ifs here)
 

Forum statistics

Threads
1,136,619
Messages
5,676,847
Members
419,655
Latest member
pd2021vb

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