Notion Answers

Help between Notion users


Register & Ask

It's free & easy

Get answers

Answers, votes & comments

Vote and select answers

Receive points, vote and give the solution

Question

3votes

Why does the slice formula not work properly for me?

I’m writing a Notion formula to show my goal progress with stars, and my formula is like this:

slice("⭐⭐⭐⭐⭐⭐⭐⭐⭐⭐", 0, round(prop("percentage") / 10))

There should be 2/5/6 stars for each line, but why doe it not work properly?

2 Answers

2votes

polle Points77470

Emoji count as two characters, try with this:

slice("⭐⭐⭐⭐⭐⭐⭐⭐⭐⭐", 0, round(prop("percentage") / 10) * 2) 

Hope it helps :)

0vote

nosy commented

Thank you, that worked!

3votes

bensomething Points2440

As @polle mentioned a lot of emojis don't register as one character so the slice function doesn't play very nice. Unfortunately some emojis register as even more than two characters, so you might have to do something like the following for other emojis.

replaceAll(slice("xxxxxxxxxx", 0, round(prop("percentage") / 10)), "x", "⭐️")

0vote

polle commented

Something new for me. Thanks for sharing!

0vote

nosy commented

Thank you for adding that info!

Please log in or register to answer this question.

...

Welcome to Notion Answers, where you can ask questions and receive answers from other members of the community.

Please share to grow the Notion Community!

Connect