excelimagecheckboxpercentage

Excel dynamic images based on percentage values and removal of checkbox description during hover


I am using MS Excel 2016 and I have here a Habit Tracker created with a growing plant images in it based on the percentage of a cell. I have a problem about getting the correct image to certain percentage values.

These are the images below stored to another sheet called "Images".

growing plant image

D22 is the cell where the percentage values show.

This is the formula to the cell where the dynamic images are put:

=IF(D22=0,"",IF(D22<=0.07,Images!$A$2,IF(D22<=0.13,Images!$B$2,IF(D22<=0.2,Images!$C$2,IF(D22<=0.27,Images!$D$2,IF(D22<=0.33,Images!$E$2,IF(D22<=0.4,Images!$F$2,IF(D22<=0.47,Images!$G$2,IF(D22<=0.53,Images!$H$2,IF(D22<=0.6,Images!$I$2,IF(D22<=0.67,Images!$J$2,IF(D22<=0.73,Images!$K$2,IF(D22<=0.8,Images!$L$2,IF(D22<=0.87,Images!$M$2,IF(D22<=0.93,Images!$N$2,IF(D22<=1,Images!$O$2,""))))))))))))))))

Correct image changes are working for values:

D22<=0.07
D22<=0.27
D22<=0.47
D22<=0.67
D22<=0.87

Incorrect image changes for values below - it is like advancing to the next image:

D22<=0.13 instead it is showing the image that is supposed to be for D22<=0.2
D22<=0.33 instead it is showing the image that is supposed to be for D22<=0.4
D22<=0.53 instead it is showing the image that is supposed to be for D22<=0.6
D22<=0.73 instead it is showing the image that is supposed to be for D22<=0.8
D22<=0.93 instead it is showing the image that is supposed to be for D22<=1

Sample images below:

sample image

Is there something wrong with the formula?

Lastly, how to remove checkbox desriptions, "true" or "false" during hover. I tried checking Data Validation if there's something I can edit but there's nothing.

checkbox image

Help is greatly appreciated.


Solution

  • The issue with your formula likely stems from how Excel evaluates the IF conditions. Excel evaluates conditions sequentially and stops at the first TRUE condition. If the conditions are not precisely aligned with the ranges you intend, it can lead to mismatched results. I would suggest re-writing your formula. If you prefer using IFs you could rewrite the formula with mutually exclusive conditions using AND. For example:

    =IF(D22=0,"",
    IF(AND(D22>0, D22<=0.07), Images!$A$2,
    IF(AND(D22>0.07, D22<=0.13), Images!$B$2,
    IF(AND(D22>0.13, D22<=0.2), Images!$C$2,
    IF(AND(D22>0.2, D22<=0.27), Images!$D$2,
    IF(AND(D22>0.27, D22<=0.33), Images!$E$2,
    IF(AND(D22>0.33, D22<=0.4), Images!$F$2,
    IF(AND(D22>0.4, D22<=0.47), Images!$G$2,
    IF(AND(D22>0.47, D22<=0.53), Images!$H$2,
    IF(AND(D22>0.53, D22<=0.6), Images!$I$2,
    IF(AND(D22>0.6, D22<=0.67), Images!$J$2,
    IF(AND(D22>0.67, D22<=0.73), Images!$K$2,
    IF(AND(D22>0.73, D22<=0.8), Images!$L$2,
    IF(AND(D22>0.8, D22<=0.87), Images!$M$2,
    IF(AND(D22>0.87, D22<=0.93), Images!$N$2,
    IF(AND(D22>0.93, D22<=1), Images!$O$2, ""))))))))))))))))
    

    I prefer using SWITCH which I think makes it more readable:

    =IF(D22=0, "",
        IFS(
            AND(D22>0, D22<=0.07), Images!$A$2,
            AND(D22>0.07, D22<=0.13), Images!$B$2,
            AND(D22>0.13, D22<=0.2), Images!$C$2,
            AND(D22>0.2, D22<=0.27), Images!$D$2,
            AND(D22>0.27, D22<=0.33), Images!$E$2,
            AND(D22>0.33, D22<=0.4), Images!$F$2,
            AND(D22>0.4, D22<=0.47), Images!$G$2,
            AND(D22>0.47, D22<=0.53), Images!$H$2,
            AND(D22>0.53, D22<=0.6), Images!$I$2,
            AND(D22>0.6, D22<=0.67), Images!$J$2,
            AND(D22>0.67, D22<=0.73), Images!$K$2,
            AND(D22>0.73, D22<=0.8), Images!$L$2,
            AND(D22>0.8, D22<=0.87), Images!$M$2,
            AND(D22>0.87, D22<=0.93), Images!$N$2,
            AND(D22>0.93, D22<=1), Images!$O$2
        )
    )
    

    You could also create a lookup table, something like:L

    Min Value Max Value Image Reference
    0 0.07 Images!$A$2
    0.07 0.13 Images!$B$2
    0.13 0.2 Images!$C$2
    0.2 0.27 Images!$D$2
    0.27 0.33 Images!$E$2
    0.33 0.4 Images!$F$2
    0.4 0.47 Images!$G$2
    0.47 0.53 Images!$H$2
    0.53 0.6 Images!$I$2
    0.6 0.67 Images!$J$2
    0.67 0.73 Images!$K$2
    0.73 0.8 Images!$L$2
    0.8 0.87 Images!$M$2
    0.87 0.93 Images!$N$2
    0.93 1 Images!$O$2

    and use a LOOKUP function to find the appropriate image reference. Assuming the table is in Images!A2:C17, you can use:

       =IF(D22=0, "", LOOKUP(D22, Images!A2:A17, Images!C2:C17))