Help between Notion users

It's free & easy

Receive points, vote and give the solution

1vote

# Turning a string formatted formula to number format

I'm trying to work on an e-commerce inventory system. My problem is I have a formula with an if statement that refuses to go to a number format. I need that format so that this can transition another formula I have.

I have four number fields and a select field. Three of the number fields indicate a price structure, and the fourth field indicates an inventory count number. The select field only picks from the three pricing structures.

``if(prop("Price Basing") =="Retail",prop("Retail Price"),(if(prop("Price Basing") == "Agency",prop("Agency Price"), if(prop("Price Basing") == "Wholesale", prop("Wholesale Price"),0))))``

The formula is a series of if statements for each possible selection of pricing structures, but after the formula saves, it still comes out as a string. It needs to be a number so that an output will come out for this next formula.

``if(prop("Order Price") == "0", "N/A", prop("Order Price") * abs(prop("Count")))``

The problem is even if I plainly multiply prop("Order Price") with abs(prop("Count"), the field ends up blank. This to me looks like the formula not being accepted as a number format that is messing with this. Is there anything I can do here?

Hi,

there is a little magic trick I often use called:

``.format().toNumber()``

Try to add it behind the first formula and let me know if it worked.

P.S.
The formula should look like this:

``if(prop("Price Basing") =="Retail",prop("Retail Price"),(if(prop("Price Basing") == "Agency",prop("Agency Price"), if(prop("Price Basing") == "Wholesale", prop("Wholesale Price"),0)))).format().toNumber()``

1vote

### headsniper commented Nov 6, 2023

Thank you good sir, I got it working! This is great to have in the ol' toolbelt.

### Martin_SystemsHill commented Nov 7, 2023

You are welcome. Happy to help.

...