ExcelBanter

ExcelBanter (https://www.excelbanter.com/)
-   Excel Programming (https://www.excelbanter.com/excel-programming/)
-   -   Formatting with IF Statement (https://www.excelbanter.com/excel-programming/272460-formatting-if-statement.html)

JAD[_2_]

Formatting with IF Statement
 
I would like to format a cell that will either show the
value as "LF" or as a quantity using the "(xx)" format.
Although the following IF statement is in a modified
format, the idea should be understandable to what I am
trying to do.

IF( G1 = "x", format cell Q1 as "lf", else format
as "(xx)" )

Intended Results: If the user enters an x in cell G1,
format the inputted number with the letters "lf" for
linear feet. If the user does not enter an x in cell G1,
format the inputted number with "( )" designating a
quantity around the value.

Richard Choate

Formatting with IF Statement
 
You were almost there already. You aren't really trying to format as LF or
as (xx), you want that text to appear in the cell. therefore, just use
=IF(G1 = "x","lf","(xx)"). This assumes that you want to compare G1 to
some text that you will put within quotes, and you are not wanting "x" to be
a variable. For instance, =IF(G1 = "John","lf","(xx)") will yield "lf"
(without the quotes) if cell G1 says John (and you are not putting this
formula in G1). But if G1 is a number, then you would want to change your
formula to: =IF(G1 = 57,"lf","(xx)") . this assumes of course, that you
want lf in your formula cell if G1 is the number 57. Hopefully this makes
sense.
Richard Choate


"JAD" wrote in message
...
I would like to format a cell that will either show the
value as "LF" or as a quantity using the "(xx)" format.
Although the following IF statement is in a modified
format, the idea should be understandable to what I am
trying to do.

IF( G1 = "x", format cell Q1 as "lf", else format
as "(xx)" )

Intended Results: If the user enters an x in cell G1,
format the inputted number with the letters "lf" for
linear feet. If the user does not enter an x in cell G1,
format the inputted number with "( )" designating a
quantity around the value.




All times are GMT +1. The time now is 04:53 PM.

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