user2786962
user2786962

Reputation: 469

Format a number format based on if condition in excel

I have a cell containing or Dollar. If the cell value is Dollar then the next cell format should be in Dollar sign and if its percentage then its format should be percentage form. How can I do this using if condition in excel

enter image description here

As shown in the picture above if the cell takes percentage value it is 60% and if it takes Dollar value it is $60.

Upvotes: 1

Views: 587

Answers (1)

Dirk Reichel
Dirk Reichel

Reputation: 7979

I assume the cell to look at is A1

For the format changing cell:

  • conditional formatting
  • formula
  • for currency:
    • =LEFT(CELL("format",A1))="C"
    • set the format for currency
  • for percentage:
    • =LEFT(CELL("format",A1))="P"
    • set the format for percentage

However: if the other cell just uses a formula like =A1 then it should change automatically (if the format is set to "general")

Upvotes: 1

Related Questions