Updated with condition for no abbreviation.
I don't think it's too much overhead just use javascript to get there. The below code works, though not as fast as using a straight sheets formula such as:
=If(isnumber(right(A1,1)+0),A1,value(mid(A1,1,len(A1)-1))*
iferror(1000^match(right(A1,1),{"K","M","B","T","Q"},0),1))
or as an array formula:
=filter(if(ISNUMBER(right(A1:A,1)+0),A1:A,value(mid(A1:A,1,
len(A1:A)-1))*iferror(1000^match(right(A1:A,1),
{"K","M","B","T"},0),1)),A1:A<>"")
Using App scripts is slower, but this works. You can add in more conditions to clean your incoming string.
function unabbreviateNumber(someInput) {
const someLetters = ["k", "m", "b", "t", "q"];
var lastLetter = someInput.toString().slice(someInput.length - 1, someInput.length).toLowerCase();
if (isNaN(lastLetter)){
//example string cleanup
someInput = someInput.replace(/ /g, ''); //removes all spaces
someInput = someInput.replace(/\$/g, ''); //removes dollar sign
const zOutput = parseFloat(someInput.slice(0, someInput.length - 1));
const zMultiplier = someLetters.findIndex(x => x == lastLetter) + 1;
return zOutput * 1000 ** zMultiplier;
}else{
return someInput;
}
}