Is there a way to handle NaN values and keep a field blank instead when calculating margins with a formula? https://i.stack.imgur.com/JvIRQ.png
Template
<form>
<div class="row">
<div class="mb-3 col-sm-4 col-xs-12">
<h6 class="text-dark" for="purchasePrice">x:</h6>
<input
type="text"
class="form-control"
autocomplete="off"
v-model="purchasePrice"
@keypress="isNumber($event)"
/>
</div>
<div class="mb-3 col-sm-4 col-xs-12">
<h6 class="text-dark" for="salePrice">y:</h6>
<input
type="text"
class="form-control"
autocomplete="off"
v-model="salePrice"
@keypress="isNumber($event)"
/>
</div>
<div class="mb-3 col-sm-4 col-xs-12">
<h6 class="text-dark" for="marginResult">z:</h6>
<input
type="text"
class="form-control"
autocomplete="off"
disabled
:value="
(
((parseInt(salePrice) - parseInt(purchasePrice)) /
parseInt(salePrice)) *
100
).toFixed(3)
"
/>
</div>
</div>
</form>