SOLVED

# EXCEL IF FUNCTION

Hi,

this basically says if H2 or J2 are empty then return an empty string but if H2 is greater than J2 then return "overload" otherwise "apples". Fine - ok.

Now, if the values "overload" and "apples" are unknown when I write this code how do I get the output to give me "whatever the value of this string is"?  Thanks for any help. Dennis

7 Replies
best response confirmed by DennisMetro (Contributor)
Solution

# Re: EXCEL IF FUNCTION

Enter the values you want to return in cells, e.g in Y1 and Z1. You can then use

=IF(H2&J2="","",IF(H2>J2,\$Y\$1,\$Z\$1))

# Re: EXCEL IF FUNCTION

Hi Hans, Thanks. The problem is I don't know the values of Y1 and Z1. There is a range of possible values. When I know the values for Y1 and Z1 I could just put them directly into the "______" part of the code. Hence my "whatever the value of this string is".

# Re: EXCEL IF FUNCTION

I don;t understand. What do you mean by "whatever the value of this string is"? What is "this string"?

# Re: EXCEL IF FUNCTION

Sorry! I've just now realized that your original solution works! My apologies. One question, if I may. As an old school type merchant - is there a good reference book for this sort of guidance? Years ago I liked to sit at the computer but look up stuff in a manual! I know it's all online these days but sometimes I just get it faster when I'm reading it on paper rather than 2 tabs open! I think it has to do with my age. Thanks again for your help.

# Re: EXCEL IF FUNCTION

See for example Excel 2019 Bible

# Re: EXCEL IF FUNCTION

Thank you very much.

# Re: EXCEL IF FUNCTION

Excel IF function is used to evaluate one or more criteria to determine what value should be returned.
If the number entered into the first argument meets the criteria (first and second arguments) specified in the third, fourth, and fifth arguments of that function then it will return a "true" value, otherwise it will return "false". Here are some examples for you:
=IF(A2="", "N/A", A2+B3) -Returns a formula if item from cell A2 does not equal something else.= = =IF(RAND()>"0.05","No Conditional Result Found Yet","Conditional Statement") -This would look at how many times

For a comprehensive resource about excel IF statement you can read here in detail
https://www.exceltrick.com/formulas_macros/excel-if-statement/