ExcelBanter

ExcelBanter (https://www.excelbanter.com/)
-   Excel Discussion (Misc queries) (https://www.excelbanter.com/excel-discussion-misc-queries/)
-   -   An if question (https://www.excelbanter.com/excel-discussion-misc-queries/111873-if-question.html)

FreddieP

An if question
 
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(S2Z2;Z2;IF(S2Y2;Y2;X2))

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

/Freddie




Pete_UK

An if question
 
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

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(S2Z2;Z2;IF(S2Y2;Y2;X2))

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

/Freddie



FreddieP

An if question
 
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

"Pete_UK" wrote:

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

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(S2Z2;Z2;IF(S2Y2;Y2;X2))

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

/Freddie





All times are GMT +1. The time now is 08:52 PM.

Powered by vBulletin® Copyright ©2000 - 2025, Jelsoft Enterprises Ltd.
ExcelBanter.com