excelexcel-formulaconcatenation

Excel CONCATENATE that includes " in the result


I need to CONCATENATE a large table, so I can create a .csv string for a file import. The issue is that the system requires that all text fields are separated by ". In a CONCATENATE I am unable to add a " to a cell.

I have shortened the amount of columns to A and B for reference. Column A contains the first name and column B contains the last name. The end result should be "George","Washington".

When I use this function below I get George, Washington.

=CONCATENATE=(A2;",";B2)

When I add "" to the formula of the function, the result becomes ";A2;",";B2;".

=CONCATENATE(""";A2;""";",";""";B2;""")

What do I need to do to get " before and after the cell value in my CONCATENATE?

The ; is the separator I need to use and not , - I think because of country formats?


Solution

  • (Note that my list separator is the comma, and not the semicolon as you show)

    You can use the TEXTJOIN function:

    ="""" & TEXTJOIN(""",""",TRUE,A2,B2) & """"
    

    enter image description here

    If you must use the CONCATENATE function, then:

    =CONCATENATE("""",A1,""",""",B1,"""")