Fractions - Adding total then showing how many out of them are 'Greens'

Excel_User_10k

Board Regular
Joined
Jun 25, 2022
Messages
100
Office Version
  1. 2021
Platform
  1. Windows
In the area highlighted in the Screenshot, there are two grey Cells. The top one if a fraction that I want to show how many Greens there are out of all Greens, Ambers, Reds and Blues added together. So if there were 2 Greens, 1 Yellow, 1 Red, 1 Blue, it would say "2/5". I have the formula showing in the other Screenshot, highlighting the part concerning to the month that is selected (as the rest of the formula is only relevant when any of the other months is selected in the drop down box). It basically says Divide [Green] by how many there are when adding [Green], [Yellow], [Red], and [Blue]. However sometimes, especially if there are 0 Greens, it does not seem to understand. Whereas I would expect it to say "0/5" for instance, it will say something random like "0/3" even though there are still a total of 5. I suspect this is because it would be dividing the total by 0, which obviously is not mathematically sound. However, I do not know how else to write the formula to tell it this. Any ideas?
 

Attachments

  • 1664910872080.png
    1664910872080.png
    215.8 KB · Views: 16
  • 1664910887450.png
    1664910887450.png
    225 KB · Views: 19

Excel Facts

How can you automate Excel?
Press Alt+F11 from Windows Excel to open the Visual Basic for Applications (VBA) editor.

Forum statistics

Threads
1,224,828
Messages
6,181,206
Members
453,022
Latest member
RobertV1609

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