**James Steeds**

I wrote a function that we use on our certificate report to convert the engineering notation to use SI prefixes (eg 1e-6V to be 1uV). So this would represent 1e-6V/V as 1µV/V. This works nicely...

Function (stringvar inputstring)

stringvar field_string:=uppercase(totext(inputstring));

field_string:= replace(field_string, "E+", "E");

numbervar field_value;

numbervar field_value2;

(

if instr(field_string,"E")<> 0 then

(

field_value:= val(split(field_string, "E") [1]) * 10^val(split(field_string, "E") [2]);

)

else

(

field_value:=val(field_string)

);

//Convert Scientific notation to normal number, and scale ready for SI prefix

field_value2:= field_value / 10^(3* INT(INT(LOG(ABS(field_value))/log(10))/3) );

//limit number to 2sd and control reported decimal places

totext(

truncate(field_value2, 1-int( (log(abs(field_value2))/log(10)) ))

, if int( (log(abs(field_value2))/log(10)) ) <> 0 then 0 else 1

)

//add the SI prefix

& " " & mid("yzafpnµm kMGTPEZY", INT(INT(LOG(ABS(field_value))/log(10))/3) + 9, 1)

)

## 2 comments