• Hi All

    Please note that at the Chandoo.org Forums there is Zero Tolerance to Spam

    Post Spam and you Will Be Deleted as a User

    Hui...

  • When starting a new post, to receive a quicker and more targeted answer, Please include a sample file in the initial post.

Change Cell Number format based on a value

Dokat

Member
Hi,

I have a dynamic table with index formula. I need number format of the cell to match the reference cell or be able to change it based on a value on another cell.

Is it possible to change the number formatting without VBA code?

Thanks
 
Sure, you can use conditional formatting. It depends on the version of Excel you have, but anything beyond 2010 should allow you to define rules based on conditions with formats as you want. If you are not clear, share an example workbook and I can show you how to set up the rules.
 
My worksheet has confidential informationi cant share it but what i want to do is if the value in D1 =1 then D4:D11 Format "$0.0,,"M"
if the value in D1 =2 then D4:D11 Format "0.0%"
if the value in D1 =3 then D4:D11 Format "0.0"

Does this help?

Thanks
 
Hi Dokat,
Code:
Private Sub Worksheet_Change(ByVal Target As Range)
Select Case [D2]
        Case 1
        Range("D4:D11").NumberFormat = "$0.0,,"
        Case 2
        Range("D4:D11").NumberFormat = "0.0%"
        Case 3
        Range("D4:D11").NumberFormat = "0.0"
End Select
End Sub
 
Back
Top