%%[ set @rating = AttributeValue("rating") set @rating = 4.53 /* Test Value */ set @increment = 0.5 set @ratingNearestHalf = 0 set @ratingBase = 0 /* https://www.html.am/html-codes/character-codes/html-star-code.cfm I'm using ☆ ★ ½ to make my stars, same logic applies when using images. */ set @emptyStar = "☆" set @fullStar = "★" set @halfStar = "½" set @ratingOutput = "" if @rating >= 0 then if mod(@rating, 1) > @increment then set @ratingBase = FormatNumber(Subtract(@rating,1), 0) else set @ratingBase = FormatNumber(@rating, 0) endif for @s = 1 to @ratingBase do set @ratingOutput = concat(@ratingOutput,@fullStar) next @s set @ratingNearestHalf = Subtract(@rating, mod(@rating, @increment)) if subtract(@ratingNearestHalf,@ratingBase) > 0.5 then set @ratingOutput = concat(@ratingOutput,@emptyStar,@halfStar) elseif @ratingNearestHalf != @ratingBase then set @ratingOutput = concat(@ratingOutput,@halfStar) endif endif ]%% Output: rating: 4.53 increment: 0.5 mod(rating,1): 0.53 mod(rating,increment): 0.0300000000000002 ratingBase: 4 ratingNearestHalf: 4.5 ratingNearestHalf - ratingBase: 0.5 ratingOutput: ★★★★½