An if question

F

FreddieP

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 :)

/Freddie
 
P

Pete_UK

If the values in A B and C will always be in order, then you could use
a formula like this:

=HLOOKUP(D2,A2:C2,1)

This would be equivalent to:

=HLOOKUP(S2,X2:Z2,1)

using the references in your formula.

Hope this helps.

Pete
 
F

FreddieP

Hi Pete, I'm afraid it doesn't do the job. If in the example below the only
data (22) would be would be in column b instead it doesn't work.

Do you have another exmple?

/Freddie
 
Top