Notion Answers

Help between Notion users


Register & Ask

It's free & easy

Get answers

Answers, votes & comments

Vote and select answers

Receive points, vote and give the solution

Question

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?

1 Answer

2votes

Martin_SystemsHill Points3740

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

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

2votes

Martin_SystemsHill commented

You are welcome. Happy to help.

Please log in or register to answer this question.

...

Welcome to Notion Answers, where you can ask questions and receive answers from other members of the community.

Please share to grow the Notion Community!

Connect