I have a list of results that may return a decimal value between 0
and 5
. For business purposes I need to force Excel to replace the number as follows:
- Any decimal value between
0
and1
needs to show as the whole number0
- Any decimal value between
1
and2
needs to show as the whole number1
- Any decimal value between
2
and3
needs to show as the whole number2
- Any decimal value between
3
and4
needs to show as the whole number3
- Any decimal value between
4
and4.5
needs to show as the whole number4
- Any decimal value between
4.5
and5
needs to show the actual decimal value.
So, if the decimal value is 1.5
, I want Excel to show it in the cell as 1
. Or, if the decimal value is 4.5
, I want excel to show it as 4.5
.
I've tried using the following nested IF
function (in this example the number to replaces is in cell L28):
=IF(L28>=4.5,L28,IF(L28<4.5>=4,"4",IF(L28=4,"4",IF(L28<4>=3,"3",IF(L28<2>=1,"2",IF(L28<1>=0,"0"))))))
However for some reason it works on values 4
or greater, but for anything <4
still shows 4
, and I can't figure out why.
Should I be doing this in VBA instead?
Thanks in advance, and I'm hoping I explained this clearly...
Aucun commentaire:
Enregistrer un commentaire