If Less Than or Greater Than

Factotum

Board Regular
Joined
May 14, 2015
Messages
118
This is probably a simple fix, but I'm really new to Power Query and can't find an answer. I'm trying to compare square footage between two systems, but want to ignore any potential rounding differences less than -10 or greater than +10.

My original formula was [#"Sqaure Foot A"] = [#"Square Foot B"]
The result comes back TRUE or FALSE, which is the format I want

I've tried this:

if [#"Square Foot A"] - [#"Square Foot B"] > -10 and [#"Square Foot A"] - [#"Square Foot B"] < 10 then "TRUE" else "FALSE"

This one seems to work until I load it to a table. Then I get the error: "We cannot convert the value null to type logical."

Any thoughts on what I'm missing?
 

Excel Facts

Move date out one month or year
Use =EDATE(A2,1) for one month later. Use EDATE(A2,12) for one year later.
Code:
[SIZE=1]if [src1]-[src2]>-10 and [src1]-[src2]<10 then true else false[/SIZE]

src1src2src1src2CustomCustom.2src1src2CustomCustom.2
6​
9​
6​
9​
TRUE​
-3​
6​
9​
TRUE​
-3​
17​
6​
17​
6​
FALSE​
11​
17​
6​
FALSE​
11​
3​
20​
3​
20​
FALSE​
-17​
3​
20​
FALSE​
-17​
5​
5​
null
5​
Errornull
5​
5​
5​
nullErrornull
nullnullErrornull

and here is a whole description of the Error
Code:
[SIZE=1]Expression.Error: We cannot convert the value null to type Logical.
Details:
    [B][COLOR="#FF0000"]Value=[/COLOR][/B]
    Type=Type[/SIZE]
 
Last edited:
Upvote 0
Try this

Code:
= Table.AddColumn(Source, "Equal(ish)", each Number.Abs([Square Foot A]-[Square Foot B])<10)
 
Upvote 0
Sandy - thank you for adding the sample data. It was on my list to do, but I kept getting sidetracked.

Bardd - you nailed it! Thank you for your help - your solution works perfectly!
 
Upvote 0

Forum statistics

Threads
1,214,646
Messages
6,120,720
Members
448,986
Latest member
andreguerra

We've detected that you are using an adblocker.

We have a great community of people providing Excel help here, but the hosting costs are enormous. You can help keep this site running by allowing ads on MrExcel.com.
Allow Ads at MrExcel

Which adblocker are you using?

Disable AdBlock

Follow these easy steps to disable AdBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the icon in the browser’s toolbar.
2)Click on the "Pause on this site" option.
Go back

Disable AdBlock Plus

Follow these easy steps to disable AdBlock Plus

1)Click on the icon in the browser’s toolbar.
2)Click on the toggle to disable it for "mrexcel.com".
Go back

Disable uBlock Origin

Follow these easy steps to disable uBlock Origin

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back

Disable uBlock

Follow these easy steps to disable uBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back
Back
Top