Nested IF with AND statements in Salesforce to create badges

Ran into a request to create a formula field which would display a giving society badge or image on a household/account record.

Requirements:
Household can be a member of none, one, two or three possible giving circles. Giving circles are defined by three separate fields in the record.

So I have the possible combinations of:

No giving circle

Giving Circle A

Giving Circle B

Giving Circle C

Giving Circle A&B&C

Giving Circle B&C

Giving Circle A&C

Giving Circle A&B

I’m pretty new to Salesforce so I did a fair amount of research but couldn’t find many examples like this one to work from so I thought I’d share my solution to the problem (update: It’s working great and they’re thrilled). Please note that this may be the absolute WORST way to write this. I take no responsibility for the results. If you’re looking for how get the images uploaded and their resource URL: https://help.salesforce.com/articleView?id=000327122&type=1&mode=1

IF(
    AND(
        Giving >= 1000, 
        AttributeA == TRUE, 
        AttributeB == FALSE
        ),
        IMAGE("/resource/00000000/badge", "badge") &" "& IMAGE("/resource/00000000/badge", "badge"),
        IF(
            AND(
               Giving >= 1000, 
                AttributeA == TRUE, 
                AttributeB == TRUE 
            ),
                IMAGE("/resource/00000000/badge", "badge") &" "& IMAGE("/resource/00000/badge", "badge") &" "& IMAGE("/resource/000000/badge", "badge"),
            IF(
                AND(
                    giving < 1000, 
                    AttributeA == TRUE, 
                    AttributeB  == TRUE 
                ),
                    IMAGE("/resource/000000000/badge", "badge") &" "& IMAGE("/resource/00000000/badge", "badge"),
                IF(
                    AND(
                        giving >= 1000, 
                        AttributeA == TRUE, 
                        AttributeB  == FALSE
                    ),
                    IMAGE("/resource/00000000/badge", "badge") &" "& IMAGE("/resource/000000/badge", "badge") &" "&IMAGE("/resource/000000/badge", "badge"), 
                    IF(
                        AND(
                            giving >= 1000, 
                            AttributeA== FALSE, 
                            AttributeB == TRUE 
                        ), 
                        IMAGE("/resource/0000000/badge", "badge")  &" "& IMAGE("/resource/000000/badge", "badge"), 
                            IF(
                                AND(
                                    giving < 1000, 
                                    AttributeA == FALSE, 
                                    AttributeB  == TRUE 
                                ), 
                                    IMAGE("/resource/000000/badge", "badge"),
                                IF(
                                    AND(
                                        giving >= 1000, 
                                        AttributeA == FALSE, 
                                        AttributeB  == FALSE
                                        ),
                                        IMAGE("/resource/000000/badge", "badge"),
                                    IF(
                                        AND(
                                            giving  < 1000, 
                                            AttributeA == TRUE, 
                                            AttributeB  == FALSE
                                            ),
                                            IMAGE("/resource/000000/badge", "badge"),
                                        IF(
                                            AND(
                                                giving < 1000, 
                                                AttributeA == FALSE, 
                                                AttributeB == FALSE
                                            ), "", "")))))))))