# How do I combine a cell value with a string in a Google Spreadsheets formula?

I have the following `IF` condition in some cell:

``````=IF(A1>A2, "value is <C5>", "value is <D5>")
``````

where `<C5>` and `<D5>` should be the values of cells `C5` and `D5`.

I know it is a simple question but searching was not successful. I don't really know how to phrase this.

• How about just `=IF(A1>A2, C5, D5)` Apr 28, 2014 at 14:22
• @VidarS.Ramdal text is mandatory. cannot be omitted. I need something like: `"value is %s, D5"`. don't know what the syntax is. Apr 28, 2014 at 14:24
• Ah, of course. See answer below (in a second). Apr 28, 2014 at 14:25

You can use the string concatenation operator, `&`:

``````=IF(A1>A2, "value is " & C5, "value is " & D5)
``````

This is equal to, but less verbose than:

``````=IF(A1>A2, CONCAT("value is ", C5), CONCAT("value is ", D5))
``````

As to your follow-up comment, you can concatenate several strings and values:

``````=IF(A1>A2, "value is " & C5 & " right now, but could be " & D5, "value is " & D5 & " at the moment, but could be " & C5)
``````
• lovely. 10x a lot. Apr 28, 2014 at 14:32
• BDW, what if I have multiple cell values that I want to insert in different places in the text? Apr 28, 2014 at 14:35
• See revised answer. Apr 28, 2014 at 14:40
• The & is clutch. Thanks for putting both versions, I knew exactly what was happening. Aug 24, 2016 at 23:34
• The `CONCAT` function is equivalent to `&` and works on non-string values as well, but only takes 2 arguments. The `CONCATENATE` function takes 1 or more arguments and only works on strings. Sep 5 at 4:43