I want to concatenate three fields from a spreadsheet into one (the locality column). But not often do all three columns include information. The desired result is to have a single string that ends with a period, with each column being separated by a comma.
Example data:
locality |
placename |
localityname |
localitydirections |
|
|
Tulsa |
|
|
City Park |
Tulsa |
|
|
Overlook |
Chicago Ohio |
Turn right at the traffic light |
|
|
|
From the house turn left at the stop light |
Desired Output:
locality |
placename |
localityname |
localitydirections |
Tulsa. |
|
Tulsa |
|
City Park, Tulsa. |
City Park |
Tulsa |
|
Overlook, Chicago Ohio, Turn right at the traffic light. |
Overlook |
Chicago Ohio |
Turn right at the traffic light. |
From the house turn left at the stop light. |
|
|
From the house turn left at the stop light |
I have tried the following code, but I am met with an error. This code assumes:
'locality' = Column A
'placename' = Column B
'localityname' = Column C
'localitydirections' = Column D
and the rows present are rows 1 - 5
First I used the formula
=B2&", "&C2&", "&D2&"." and dragged it down to auto-populate the remaining fields.
However, it was giving me the following outcome:
locality |
placename |
locality name |
localitydirections |
, Tulsa, . |
|
Tulsa |
|
City Park, Tulsa, . |
City Park |
Tulsa |
|
Overlook, Chicago Ohio, Turn right at the traffic light. |
Overlook |
Chicago Ohio |
Turn right at the traffic light. |
, , From the house turn left at the stop light. |
|
|
From the house turn left at the stop light |
The punctuation becomes problematic with the blank fields.
What function could fix this? My initial thought was an IF function.