ExcelBanter

ExcelBanter (https://www.excelbanter.com/)
-   Excel Discussion (Misc queries) (https://www.excelbanter.com/excel-discussion-misc-queries/)
-   -   Conditional Format for Numbers (https://www.excelbanter.com/excel-discussion-misc-queries/32707-conditional-format-numbers.html)

Tyson

Conditional Format for Numbers
 
Is it possible in Excel to conditionally format a Number type in a cell
based on another cell?

Example

A1 is a dropdown with "Variance $" and "Variance %"

And in A2 I have an IF statement that that will give a result from two
other cells. What I want A2 to show is either $#.## or ##% depending
on what I have in the drop down.

Any help would be great.

Thanks

Tyson


Ron Rosenfeld

On 27 Jun 2005 12:36:59 -0700, "Tyson" wrote:

Is it possible in Excel to conditionally format a Number type in a cell
based on another cell?

Example

A1 is a dropdown with "Variance $" and "Variance %"

And in A2 I have an IF statement that that will give a result from two
other cells. What I want A2 to show is either $#.## or ##% depending
on what I have in the drop down.

Any help would be great.

Thanks

Tyson


In order to actually FORMAT the cell, you would have to either guarantee
non-overlapping values for $ vs %, which you could then test, or use a VBA
event-triggered macro.

To have it display the way you want, a simple formula can do that; but the
result is a text string and may not be useable by some functions, directly.

=IF(A1="Variance %", TEXT(your_formula,"0.00%"),TEXT(your_formula,"$0.0 0"))

If this is not satisfactory, post back and we'll derive a VBA solution.


--ron

Tyson



Ron Rosenfeld wrote:
On 27 Jun 2005 12:36:59 -0700, "Tyson" wrote:

Is it possible in Excel to conditionally format a Number type in a cell
based on another cell?

Example

A1 is a dropdown with "Variance $" and "Variance %"

And in A2 I have an IF statement that that will give a result from two
other cells. What I want A2 to show is either $#.## or ##% depending
on what I have in the drop down.

Any help would be great.

Thanks

Tyson


In order to actually FORMAT the cell, you would have to either guarantee
non-overlapping values for $ vs %, which you could then test, or use a VBA
event-triggered macro.

To have it display the way you want, a simple formula can do that; but the
result is a text string and may not be useable by some functions, directly.

=IF(A1="Variance %", TEXT(your_formula,"0.00%"),TEXT(your_formula,"$0.0 0"))

If this is not satisfactory, post back and we'll derive a VBA solution.


--ron



Perfect!

Thanks Ron.

Tyson


Ron Rosenfeld

On 27 Jun 2005 13:31:04 -0700, "Tyson" wrote:





=IF(A1="Variance %", TEXT(your_formula,"0.00%"),TEXT(your_formula,"$0.0 0"))

If this is not satisfactory, post back and we'll derive a VBA solution.


--ron



Perfect!

Thanks Ron.

Tyson


You're welcome. Glad to help. Thanks for the feedback.

--ron


All times are GMT +1. The time now is 04:22 AM.

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