I have a financial data that indicates the health of the project and depending on the variance it populates a color and a letter to indicate the health. For example, if the varinace is less than 5% it populates color green with letter "G", >5% but less than 20% populates "Y" and >20% = "R". I've used the if statements to get that. however I need to populate a color of overall projects.
There are 5 projects and these are the requirements:
- If any of the 5 projects have "R" then the overall health is "R"
- If 1/5 project is "Y" and 4/5 = "G" then the overall health is "G"
- If 2/5 = "Y" and 3/5 "G" then the overall health is "Y"
- If 3/5 = "Y"and 2/5 "G" then overall health is "Y"
- If 4/5 = "Y" and 1/5 "G" Then "Y"
- If 5/5 = "Y" then "Y"
- If 5/5 = "G" then "G"
So, if 1st project is G, 2nd project is Y 3rd project is Y, 4 Project is G and 5th project is R I want it to popoulate "R" for overall health.
I've tried using if statements but the amount of combination i have to do is too much.
How do i use VBA excel to create this kind of "ratio" requirements?
Thank you
You can create a variable for that counts each Y, R, and G and then do a simple if elseif to set a cell equal to r, y, or g based on your rules: