# IF question

#### frepez

##### New Member
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

Square and cube roots
The =SQRT(25) is a square root. For a cube root, use =125^(1/3). For a fourth root, use =625^(1/4).
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)

Replies
18
Views
424
Replies
2
Views
110
Replies
5
Views
87
Replies
4
Views
90
Replies
2
Views
98

1,214,685
Messages
6,120,876
Members
448,993
Latest member
InquisitiveFrog

### 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?

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