Custom Formulas

I’m slowly moving from Google Sheets to Coda, bit of a learning curve – but looks promising.

In GSheets I have a custom formula to convert units into categories.

20 a units = 1 b Unit

8 b units = 1 c unit

So value 20 will result in an output of “1b”

Value 180 will result in an output of “1c 1b 5a”

I achieved this in GSheet’s script editor:

function COINCAT(input) {

var stringout = ""
var n = input;
var c = Math.floor((n/160));
var b = Math.floor((n - (t*160))/20)
var a = n-(t*160)-(c*20)

if (c > 0) {
stringout = c + "c"
}

if (b > 0) {
stringout = stringout + " " + b + "b"
}

if (a > 0) {
stringout = stringout + " " + a + "a"
}

return stringout.trim();

}

Is there similar functionality in Coda as this will prevent a lot of messy formula’s everywhere trying to do this ‘by hand’ each time it’s needed on the document (a lot!)

Thanks

I’ve split this up into separate columns to show how it works, but it may give you more flexibility to use the data depending on your setup.

It’s really just using the Floor() and Remainder() formulas repeating the process as you get to smaller units.

This topic was automatically closed 90 days after the last reply. New replies are no longer allowed.