How to close an 'if' statement in Power Query?

cr731

Well-known Member
Joined
Sep 17, 2010
Messages
611
I'm trying to write an IF statement in Power Query but I want to concatenate the result of the IF statement with something else but am running into trouble. I have,

Code:
if [ColumnTest"] = "No" then "1" else "0" & "-" & [Column2]

So basically the result should be either

1-Column2Value or
0-Column2Value

but instead I get either

1 or
0-Column2Value

It's only readying the concatenation part on "else"

I tried wrapping the IF in parenthesis but it doesn't work

Code:
if ( [ColumnTest"] = "No" then "1" else "0" ) & "-" & [Column2]

How do I tell Power Query that my IF statement is complete?
 

Excel Facts

Format cells as time
Select range and press Ctrl+Shift+2 to format cells as time. (Shift 2 is the @ sign).
Throw that first bracket before the if and it should work (so the whole if statement is contained in brackets)
 
Upvote 0

Forum statistics

Threads
1,224,151
Messages
6,176,715
Members
452,740
Latest member
MrCY

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