• 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.

Conditional indent???

I want to apply an indentation based on a condition. I was thinking that I can use an IF statement to test a condition, then if it is true maybe I can insert the ASCII code that corresponds to an indent character if there is one.

How would this be done?
 
Hi ,

As Faseeh has posted , if you are going to use a formula , the only way to indent is to convert the data into text , which means if you have numbers in the cells , you will not be able to use them as numbers.

The alternatives are VBA , and CF ; using CF , you can put the condition in your CF formula , and choose a custom format where the number of spaces required are inserted in the format. Thus a format having 5 leading spaces followed by a 0 will retain the numeric format , and at the same time display the number properly indented ; for this to work , you will have to choose a default format of left aligned ; if you want the default format to be right aligned , then you need to use a CF format of 0 followed by 5 trailing spaces , so that the resulting number will be displayed properly indented.

Narayan
 
Back
Top