I have an Excel IF statement and I need help with the syntax of complex \"if TRU
ID: 3560683 • Letter: I
Question
I have an Excel IF statement and I need help with the syntax of complex "if TRUE" part.
Specifically, the "if TRUE" part has to start out with text then have a formula that calculates a number and then have a following text.
Except that it correctly calculates the number and inserts it in the correct place, along with the following text "dollars", the IF syntax shown below DOES NOT WORK.
If(A1>B1), "Today's price for this product is " & (((C1*100)/D1))-100 & " dollars", "product not available".
The problem with the above syntax is that EXCEL does not want the comma after the second & (the comma that starts the ELSE statement) and suggest its elimination. When I accept this suggestion correction both the "if true" and the "else" print out.
I have tried this syntax with and without the concatenating ampersands but no luck.
Any help appreciated
Explanation / Answer
)(&*&) No, One of the several problems is that you have a parenthesis after B1, effectively ending the IF statement.
Looking at your IF statement as written, it is not at all clear to me what you are trying to accomplish. It looks like if A1 is NOT > B1`, you want today's price to be sheep or goats or chickens. Is that really the case?
It seems you want one outcome if A1 is more than B1, but I think it would help if you wrote out, in words, exactly what you want to happen. Produce some examples for A1>B1 as well as the opposite. I suspect if you do that you will be able to devise the proper formula, using the technique I provided in your previous similar posting.
To get something when A1>B1, you could use:
=IF(A1>B1,"Today's price for this product is " & (((C1*100)/D1))-100)
It is not clear to me what outcome you want for the ELSE part.
If you need to format the calculated value, something like:
=IF(A1>B1,"Today's price for this product is "&TEXT((((C1*100)/D1))-100,"$#,##0.00"))
or, taking advantage of Excel's order of evaluating to eliminate redundant parentheses:
=IF(A1>B1,"Today's price for this product is "&TEXT(C1*100/D1-100,"$#,##0.00"))
Related Questions
drjack9650@gmail.com
Navigate
Integrity-first tutoring: explanations and feedback only — we do not complete graded work. Learn more.