# Power Query New Column Concatenate Problem

#### gheyman

##### Well-known Member
I created a new column and contatenated these values without any problems.

= Table.AddColumn(#"Added Custom2", "Detail Comments", each "{Excess Cost: \$" & Number.ToText([#"Excess Material Cost \$"]) & "}" & " " & "{Tariff: \$" & Number.ToText([#"Tariff Cost \$"]) & "}" & " " & "{Excess Cost: \$" & Number.ToText([#"Excess Material Cost \$"]) & "}")

{Excess Cost: \$500.25} {Tariff: \$205.78} {Excess Cost: \$500.25}

But I wanted to add a Comment column (Text) to it. Once I do this the new column is blank. can someone explain what I am doing wrong?

[Qty Comment] &"{Excess Cost: \$" & Number.ToText([#"Excess Material Cost \$"]) & "}" & " " & "{Tariff: \$" & Number.ToText([#"Tariff Cost \$"]) & "}" & " " & "{Excess Cost: \$" & Number.ToText([#"Excess Material Cost \$"]) & "}"

The Formula does not tell me I have a syntax error so I dont understand why this does not work. it comes up null.

Thanks for the help.

### Excel Facts

What is =ROMAN(40) in Excel?
The Roman numeral for 40 is XL. Bill "MrExcel" Jelen's 40th book was called MrExcel XL.
Try it like this:

Power Query:
``each let QC = [Qty Comment] in (if QC=null then "" else QC) &"{Excess Cost: \$" & Number.ToText([#"Excess Material Cost \$"]) & "}" & " " & "{Tariff: \$" & Number.ToText([#"Tariff Cost \$"]) & "}" & " " & "{Excess Cost: \$" & Number.ToText([#"Excess Material Cost \$"]) & "}"``

Joining a null with anything will return null, so the code above changes the null to zero length text. If any of the other columns you're concatenating might contain a null you will need to do something similar with them.

If the embedded "let ... in" bothers you, this will do the same thing a little less efficiently:

Power Query:
``each (if [Qty Comment] =null then "" else [Qty Comment]) &"{Excess Cost: \$" & Number.ToText([#"Excess Material Cost \$"]) & "}" & " " & "{Tariff: \$" & Number.ToText([#"Tariff Cost \$"]) & "}" & " " & "{Excess Cost: \$" & Number.ToText([#"Excess Material Cost \$"]) & "}"``

That was the problem (null). Thank you!

If your version supports it, you can also use the coalesce operator:

Power Query:
``([Qty Comment]??"") &"{Excess Cost: \$" & Number.ToText([#"Excess Material Cost \$"]) & "}" & " " & "{Tariff: \$" & Number.ToText([#"Tariff Cost \$"]) & "}" & " " & "{Excess Cost: \$" & Number.ToText([#"Excess Material Cost \$"]) & "}"``

or use `Text.Combine` and pass the sections as a List.

Replies
6
Views
211
Replies
4
Views
264
Replies
5
Views
201
Replies
8
Views
199
Replies
7
Views
2K

1,203,067
Messages
6,053,335
Members
444,654
Latest member
Rich Cohen

### 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.

### Which adblocker are you using?

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

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