Conditional formatting to balance two values

Richarizard

New Member
Joined
Jan 5, 2023
Messages
2
Office Version
  1. 365
Platform
  1. Windows
I have two values (potentially more later) that are amounts spent by different parties that I want to balance.

I want to use a 3-Color scale, where a party that has contributed more will be more blue, and less will be more yellow. The closer to being balanced would gradient to the cells being green. I think I need to use the percentage of the contribution from each party, but I'm not entirely sure on how to set that up.

Any help would be greatly appreciated!
 

Excel Facts

Format cells as date
Select range and press Ctrl+Shift+3 to format cells as date. (Shift 3 is the # sign which sort of looks like a small calendar).
I want to use a 3-Color scale,
You want a gradient result or 3 distinct colours? Methinks that for the former, you will definitely need code that alters the percentage of blue vs yellow based on the inputs. That means it's really a 2 colour scale (blue-yellow) assuming you're going to leave red alone. Even easier if you can just alter one colour and range from 0 yellow (or 0 blue) to 255.

You don't say how many parties are involved so I think you would have to know that at the time of computation because the max of any colour value will be 255. If my contribution is 10% (25.5), the other 90% is spread over a variable population? You'd probably also have to round because I don't think you can assign 25.5 of yellow to me, and you can't go over 255, which would be possible with rounding.

EDIT - forgot to mention that CF can be done solely in code, or you can use CF dialogs to call a vba function, IIRC.
 
Upvote 0
I was planning on using a gradient, and I was only going to have two parties to begin with, and then potentially expand from there.

I was hoping that I could do it with just CF formulas, but I couldn't figure out how.

I ended up calculating the percentage of each contribution in the cell below the totals, then applied a percentage CF to those, and used code to mirror the cell color onto the cell with the original totals. It feels like there should be a more elegant way to do it, but I got it done!
 
Upvote 0

Forum statistics

Threads
1,215,046
Messages
6,122,849
Members
449,096
Latest member
Erald

We've detected that you are using an adblocker.

We have a great community of people providing Excel help here, but the hosting costs are enormous. You can help keep this site running by allowing ads on MrExcel.com.
Allow Ads at MrExcel

Which adblocker are you using?

Disable AdBlock

Follow these easy steps to disable AdBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the icon in the browser’s toolbar.
2)Click on the "Pause on this site" option.
Go back

Disable AdBlock Plus

Follow these easy steps to disable AdBlock Plus

1)Click on the icon in the browser’s toolbar.
2)Click on the toggle to disable it for "mrexcel.com".
Go back

Disable uBlock Origin

Follow these easy steps to disable uBlock Origin

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back

Disable uBlock

Follow these easy steps to disable uBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back
Back
Top