+ Reply to Thread
Results 1 to 11 of 11

Indent in relation to numeric cell value

  1. #1
    Forum Contributor jason.hampton's Avatar
    Join Date
    04-20-2012
    Location
    Republic of Texas
    MS-Off Ver
    2007, 2010, 2016
    Posts
    138

    Indent in relation to numeric cell value

    All,

    Attached is a sample spreadsheet created in Excel 2010.

    Column A is an excerpt from a large workbook I am working on. My goal is to have the data in Column A indent based on its numerical value.

    I was eperimenting and created an IF arguement in Column B; which somewhat accomplishes this. My concen is that if you hid column A, the formula in column B could be altered by accident.

    I've tried to create a conditional formatting for this; to no avail. Any help would be appreciated!
    Attached Files Attached Files
    Best Regards,

    Jason Hampton
    Freedom Isn't Free

  2. #2
    Forum Expert Sam Capricci's Avatar
    Join Date
    06-14-2012
    Location
    Palm Harbor, Florida
    MS-Off Ver
    16.95 for Mac MS 365
    Posts
    8,682

    Re: Indent in relation to numeric cell value

    Is there some reason you don't just want to highlight col B and use the alignment button in the Home tab?
    Make contributors happy, click on the "* Add Reputation" as a way to say thank you.
    Sam Capricci

  3. #3
    Forum Contributor jason.hampton's Avatar
    Join Date
    04-20-2012
    Location
    Republic of Texas
    MS-Off Ver
    2007, 2010, 2016
    Posts
    138

    Re: Indent in relation to numeric cell value

    Sambo kid,

    I don't want to indent it manually. Besides there are times when the numeric values are as high as 14. My goal would be to have the condition result in - cell value =0; indent 0; cell value =1; indent 1 etc.

  4. #4
    Forum Expert Sam Capricci's Avatar
    Join Date
    06-14-2012
    Location
    Palm Harbor, Florida
    MS-Off Ver
    16.95 for Mac MS 365
    Posts
    8,682

    Re: Indent in relation to numeric cell value

    Ok, just wanted to check that. Sometimes the most obvious answer is overlooked.
    So just to be a little more clear, 0 isn't indented, 1 is bumped in one space, 2 - 2 spaces, 3 - 3 spaces etc? Is that correct?

  5. #5
    Forum Contributor jason.hampton's Avatar
    Join Date
    04-20-2012
    Location
    Republic of Texas
    MS-Off Ver
    2007, 2010, 2016
    Posts
    138

    Re: Indent in relation to numeric cell value

    Yes sir, that is correct

  6. #6
    Forum Expert Sam Capricci's Avatar
    Join Date
    06-14-2012
    Location
    Palm Harbor, Florida
    MS-Off Ver
    16.95 for Mac MS 365
    Posts
    8,682

    Re: Indent in relation to numeric cell value

    That'll help whoever is able to solve this one. If you don't want to use a formula (because my guess would have been something along the lines of where you went or a substitute formula), I tried a find and replace but haven't gotten that to work yet.

  7. #7
    Valued Forum Contributor
    Join Date
    10-26-2008
    Location
    Birmingham, UK
    MS-Off Ver
    All versions up to 2010
    Posts
    1,025

    Re: Indent in relation to numeric cell value

    Hi
    I found a function on the internet that did what you want. See sample attached.
    Once you have the formatting you want you can remove the formulae.
    Good luck.
    Tony

    Note: The function is stored in a module and called from a formula in each cell in Column C in the sample.
    Attached Files Attached Files

  8. #8
    Forum Contributor jason.hampton's Avatar
    Join Date
    04-20-2012
    Location
    Republic of Texas
    MS-Off Ver
    2007, 2010, 2016
    Posts
    138

    Re: Indent in relation to numeric cell value

    ARGK,

    Thank you for that! It seems to work flawlessly. One benifit is this code will work on non-.xslm files. There would not be any need to enable macros.

    Attached is a macro code one other guy in my office created me, in tandem with this posting.

    Please Login or Register  to view this content.

  9. #9
    Forum Expert martindwilson's Avatar
    Join Date
    06-23-2007
    Location
    London,England
    MS-Off Ver
    office 97 ,2007
    Posts
    19,320

    Re: Indent in relation to numeric cell value

    why not just use in col b
    =REPT(" ",A2)&A2
    unlock all cells
    then hide col a
    then lock cells and hide formulas in column b only
    then protect sheet
    Attached Files Attached Files
    "Unless otherwise stated all my comments are directed at OP"

    Mojito connoisseur and now happily retired
    where does code go ?
    look here
    how to insert code

    how to enter array formula

    why use -- in sumproduct
    recommended reading
    wiki Mojito

    how to say no convincingly

    most important thing you need
    Martin Wilson: SPV
    and RSMBC

  10. #10
    Forum Contributor jason.hampton's Avatar
    Join Date
    04-20-2012
    Location
    Republic of Texas
    MS-Off Ver
    2007, 2010, 2016
    Posts
    138

    Re: Indent in relation to numeric cell value

    martindwilson,

    That seems to work very well. Depending on what you are doing you could modify the protection of the worksheet to select, modify cells when protected. Thanks.

  11. #11
    Forum Expert martindwilson's Avatar
    Join Date
    06-23-2007
    Location
    London,England
    MS-Off Ver
    office 97 ,2007
    Posts
    19,320

    Re: Indent in relation to numeric cell value

    you just unprotect when you need,there are lots of options in protect must admit i havent tried them all but you only have to lock column b

+ Reply to Thread

Thread Information

Users Browsing this Thread

There are currently 1 users browsing this thread. (0 members and 1 guests)

Similar Threads

  1. Conditional Formatting, Indent Text in Cell
    By iyoung2001 in forum Excel Formulas & Functions
    Replies: 12
    Last Post: 02-14-2020, 05:24 PM
  2. Can you use a hanging indent in an Excel cell?
    By DBTI in forum Excel General
    Replies: 3
    Last Post: 01-21-2020, 12:31 PM
  3. How wrap text in a cell is indent?
    By kent97 in forum Excel General
    Replies: 3
    Last Post: 02-26-2015, 11:03 AM
  4. Indent move cell, 2 indent move 2 cells etc
    By jomuir in forum Excel General
    Replies: 3
    Last Post: 05-14-2012, 11:56 AM
  5. [SOLVED] How can I remove an indent within a cell?
    By DB--less than excel expert in forum Excel General
    Replies: 5
    Last Post: 02-17-2006, 04:20 PM

Bookmarks

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts

Search Engine Friendly URLs by vBSEO 3.6.0 RC 1