Help

Formula question OR

1857 6
cancel
Showing results for 
Search instead for 
Did you mean: 
Michael_Lever
7 - App Architect
7 - App Architect

Before the forum goes down temporarily I’d apprecate please help for how to use OR in a formula field.

Example: three fields:
Number 1
Number 2
Total

I want to enter a decimal number is Number 1 or Number 2 (but not both) and have the result displayed in Total.

So far I have managed to get some respone from

OR({Number 1},{Number 2})

In Number 1 I have entered 45.00. In Total, however, the display is 1.00 whereas it shoukd be 45.00

tia

6 Replies 6
goksan
6 - Interface Innovator
6 - Interface Innovator

Hey @Michael_Lever

Something like this seems to work:

IF({Number 1}, {Number 1}, IF({Number 2}, {Number 2}, ""))

Thank you, it does work … however. Because (to quote AT) the result type is not a number or a date, formatting options are currently only available if the result type is a number or a date.

The example I provided is simplistic. I need a formula for displaying numbers to 3 decimal places.

goksan
6 - Interface Innovator
6 - Interface Innovator

Ah gotcha

IF({Number 1}, {Number 1}, IF({Number 2}, {Number 2}, 0))

This version should allow you to add your formatting.

I’ve just changed the fallback in the absence of both values from an empty string "" to 0 to ensure that all outputs are a number.

I should also add that my Number 1 and Number 2 fields are of type Number
image

goksan
6 - Interface Innovator
6 - Interface Innovator

If the 0 fallback is a deal breaker you should be able to apply your 3 decimal place precision on Number 1 and Number 2 and continue using the old formula which doesn’t allow formatting.

Thank you very much.

For my requirements in practice, i have a table for dimensions (width and depth) and ares and analysing rent GBP £psf or £psm. I have designed the table for entering the dimensions either or both in imperial or metric - also metric dimensions to convert automatically to imperial using duo-decimals - multiply to sqft and/or sqm. Also average differences in depth or width by adding the two widths or depths then dividing by 2.

Before your formula I have been entering the resultant (auto) sqm converted into sqft into a second field sqft (which doubles as manual entry sqft) before the next stage analysing the rent. Using the formula will enable me to skip entering the auto sqft.

Glad to see that you were able to get something that works!

To clarify something from your initial post…

The OR() function doesn’t return the actual values of the listed fields. Similar to AND(), it returns a boolean value—True or False—based on the passed arguments. That value is then converted to a number—1 for True, 0 for False—to be the field output.

Here’s the brief rundown of OR() vs AND():

  • The OR() function will return True if any of the arguments passed are truthy (equivalent to True: a non-empty string, a non-zero number, etc.); otherwise it will return False.
  • The AND() function will return True only when all of the arguments passed are truthy.

This explains why 45 became 1: 45 is a non-zero number, which meant that at least one of the passed arguments was truthy, so OR() returned True, which became 1.