Ask Your Question

How do I conditionally concatenate strings in Calc using 'if'? [closed]

asked 2014-06-09 16:46:15 +0200

this post is marked as community wiki

This post is a wiki. Anyone with karma >75 is welcome to improve it.

i want to merge the value of 3 cells into a new cell.

  • D = title
  • E = first name
  • F = second name

=E2 & " " & F2 works fine and merge the name together but not every row has an title so i´m looking for a script like:

=(IF(D2 is not empty print the value incl. a space behind)) & E2 & " " & F2

maybe anyone can help me?

edit retag flag offensive reopen merge delete

Closed for the following reason the question is answered, right answer was accepted by Alex Kemp
close date 2016-02-26 00:02:49.220147

2 Answers

Sort by » oldest newest most voted

answered 2014-06-09 17:35:46 +0200

Rugslug gravatar image

One solution:

=IF(ISBLANK(D1),E1&" "&F1,D1&" "&E1&" "&F1)
edit flag offensive delete link more


If the text-value in D1 is already the result of an expression testing with ISBLANK() will not work. In this case you have to test for "not the empty string". The formula may look then as follows:

=IF(D1="";"";D1&" ")&E1&" "&F1

Lupp gravatar imageLupp ( 2014-06-09 18:30:40 +0200 )edit

Thank you! It works great!

rogerr gravatar imagerogerr ( 2014-06-10 18:46:36 +0200 )edit

@rogerr could you please accept the answer so others know your question was answered?

bencomp gravatar imagebencomp ( 2014-06-23 21:42:41 +0200 )edit

Question Tools

1 follower


Asked: 2014-06-09 16:46:15 +0200

Seen: 5,916 times

Last updated: Jun 23 '14