1

I need dependent cells in an Excel worksheet to follow the decimal formatting of a parent cell. I've done this with format painter, but my parent cell decimal requirements change from time to time, and I need the dependent cells to adjust and update accordingly.

Sometimes I might need to show no decimal places, while other times I'll need to show one, or possibly two places.

In short, I want to change the decimal formatting of the parent cell and have this dictate the dependent cells on a per case basis.

Please see the following screenshots for examples of what I want to accomplish:

For illustration only, the parent cell is in red, dependent cells in yellow.  I don't need anything other than the decimal formatting to be copied so color is not an issue.

3
  • You will need vba that copy and pastes the formatting and run it manually as neither vba nor formula will trigger on the change of format. Commented Aug 19, 2019 at 19:57
  • thanks for your comment. I found some help elsewhere and found a quick VBA to run.
    – rmlax
    Commented Aug 19, 2019 at 20:13
  • 1
    Welcome to Super User. You posed an interesting question that other people may also have. If you found a solution, please consider posting an answer (sharing solutions to help others with a similar problem is what the site is all about).
    – fixer1234
    Commented Aug 19, 2019 at 21:43

1 Answer 1

0

I understand you've found a VBA solution, it would be helpful for others if your shared it.

For others who prefer a non-VBA solution, Conditional Format easily handles Scenarios 1 and 3 and can likely be modified to for your specific needs. No VBA required.

Each scenario requires a conditional format.

Scenario 1: the formula is =Int($F$2)-($F$2)=0 and the conditional number format is Number with 0 decimal places

Scenario 3: the formula is =Int($F$2)-($F$2)<>0 and the conditional number format is Number with 2 decimal places

For both Scenarios: the fill color is yellow and the applies to range is $B$4, $D$3, $D$4, $F$3, $F$4, etc

Now, when $F$2 contains an integer, the cells in the applied to range are formatted as integers and highlighted. If $F$2 is not an integer then the cells are are formatted to display 2 decimal places.

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .