Seems like your formula is same with this formula provided by @peterkilaba! : This is over my head - #14 by peterkilaba
I didn’t succeed doing that with a math formula ( but I guess there is and I see that Yongki has shared a app and I think it’s with a math formula. Didn’t checked still )
For this you can use the Abracadalo API : This is over my head - #15 by Abracadalo ( check this post from Abracadalo )
Or JavaScript : This is over my head - #20 by dilon_perera
Also maybe you can use this Mathify component made by Knight! : CSV Export & Mathify | New Component from Adalomatic