Just add spaces in between 3 words

hsandeep

Well-known Member
Joined
Dec 6, 2008
Messages
1,224
Office Version
  1. 2010
Platform
  1. Windows
  2. Mobile
How to concatenate FIRST SECOND & THIRD name in a single cell separated by a blank.
A1: Mark
B1: Hu.
C1=England

Answer:
D1: Mark Hu. England
 
Wow this works.
Can i get:
Example 1;
A1:Mark
B1: Human
C1: England
D1: M.H.England (for FIRST & SECOND word non blank)
Example 2;
A1: Mark
B1: Human
C1: ""
D1: M.Human
Example 3;
A1: Mark
B1: ""
C1: ""
D1: Mark
Example 4;
A1: Mark
B1: ""
C1: England
D1: M.England
i.e. LAST word must appear FULL & previous words in initial with "."
 
Upvote 0

Excel Facts

Do you hate GETPIVOTDATA?
Prevent GETPIVOTDATA. Select inside a PivotTable. In the Analyze tab of the ribbon, open the dropown next to Options and turn it off
Sounds like:

Code:
=IF(COUNTIF(A1:C1,"?*")=3,LEFT(A1,1)&"."&LEFT(B1,1)&"."&C1,IF(B1<>"",LEFT(A1,1)&"."&B1,IF(C1<>"",LEFT(A1,1)&"."&C1,A1)))

Matty
 
Upvote 0
Works....a small mistake...
For A1, B1 & C1 = "" (blank) NOT through formula the result is coming 0, Can it come "" (blank).
For A1, B1 & C1 = "" (blank) THROUGH formula the result is coming "" (blank). It is OK.
 
Upvote 0
Wow this works.
Can i get:
Example 1;
A1:Mark
B1: Human
C1: England
D1: M.H.England (for FIRST & SECOND word non blank)
Example 2;
A1: Mark
B1: Human
C1: ""
D1: M.Human
Example 3;
A1: Mark
B1: ""
C1: ""
D1: Mark
Example 4;
A1: Mark
B1: ""
C1: England
D1: M.England
i.e. LAST word must appear FULL & previous words in initial with "."
I am pretty sure this formula will work correctly...

=SUBSTITUTE(TRIM(IF(COUNTA(A1:A3),TRIM(LEFT(TRIM(LEFT(A1)&" "&LEFT(A2)&" "&LEFT(A3)),LEN(TRIM(LEFT(A1)&" "&LEFT(A2)&" "&LEFT(A3)))-1))&" "&LOOKUP("zzzz",A1:A3),""))," ",".")
 
Upvote 0
For A1:Mark
B1: Human
C1: "" (blank) thr' formula
D1:M (This is WRONG). I need
D1: M.Human (CORRECT)
 
Upvote 0
For A1:MarkB1: HumanC1: "" (blank) thr' formulaD1:M (This is WRONG). I needD1: M.Human (CORRECT)
Sorry, I developed my formula for cells A1:A3, not A1:C1. Here is the corrected formula...=SUBSTITUTE(TRIM(IF(COUNTA(A1:C1),TRIM(LEFT(TRIM(LEFT(A1)&" "&LEFT(B1)&" "&LEFT(C1)),LEN(TRIM(LEFT(A1)&" "&LEFT(B1)&" "&LEFT(C1)))-1))&" "&LOOKUP("zzz",A1:C1),""))," ",".")
 
Upvote 0
Here is the corrected formula...=SUBSTITUTE(TRIM(IF(COUNTA(A1:C1),TRIM(LEFT(TRIM(LEFT(A1)&" "&LEFT(B1)&" "&LEFT(C1)),LEN(TRIM(LEFT(A1)&" "&LEFT(B1)&" "&LEFT(C1)))-1))&" "&LOOKUP("zzz",A1:C1),""))," ",".")[/QUOTE]
No Same WRONG answer is coming. i.e. D1:M (WRONG). I need D1: M.Human (CORRECT)
 
Upvote 0
No Same WRONG answer is coming. i.e. D1:M (WRONG). I need D1: M.Human (CORRECT)
I modified the formula slightly; see if this one works for you....

=SUBSTITUTE(TRIM(IF(A1&B1&C1="","",TRIM(LEFT(TRIM(LEFT(A1)&" "&LEFT(B1)&" "&LEFT(C1)),LEN(TRIM(LEFT(A1)&" "&LEFT(B1)&" "&LEFT(C1)))-1))&" "&LOOKUP(2,1/(A1:C1<>""),A1:C1)))," ",".")
 
Upvote 0

Forum statistics

Threads
1,217,414
Messages
6,136,496
Members
450,016
Latest member
murarj

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.
Allow Ads at MrExcel

Which adblocker are you using?

Disable AdBlock

Follow these easy steps to disable AdBlock

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

Disable AdBlock Plus

Follow these easy steps to disable AdBlock Plus

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
Back
Top