LEFT formula without spaces

charliew

Board Regular
Joined
Feb 20, 2018
Messages
68
Office Version
  1. 365
Platform
  1. Windows
Morning everyone,

Firstly i'm sorry if this question or one similar has already been posted, i did have a good rummage but couldn't find anything that worked. I would also like to clarify that i didn't build this spreadsheet!!

I have this data in B3874
West Herts GC, Croxley Green, WD3 3GG

This is inputted using formula : =@Stock!C:C

I am currently using formula : =UPPER(LEFT(B3874,6))

Which brings results : WEST H (obviously)

This is incorrect for my needs. I need the first 6 characters NOT including spaces - WESTHE

Now, the space will be in a different location depending on the customer name, which makes it a bit harder...

Another challenge i have is if the company has less than 6 characters the additional characters need to be Q to make up the additional characters this could be identified as before the comma?

SAS, Skipton, BD23 2TZ

the above should be SASQQQ


If anyone can help, I'd be very much grateful!!!

Thank you!
 

Excel Facts

Highlight Duplicates
Home, Conditional Formatting, Highlight Cells, Duplicate records, OK to add pink formatting to any duplicates in selected range.
Hi, you could give this a try.

Book2
AB
1West Herts GC, Croxley Green, WD3 3GGWESTHE
2SAS, Skipton, BD23 2TZSASQQQ
Sheet1
Cell Formulas
RangeFormula
B1:B2B1=UPPER(LEFT(SUBSTITUTE(LEFT(A1,FIND(",",A1&",")-1)," ","")&"QQQQQQ",6))
 
Upvote 0
If you are interested, I think that you can eliminate a small part of that formula as follows.

This has a slight difference too in that if there are any blank cells in the 'name' column this formula returns "" which I am assuming is preferable to "QQQQQQ"

BTW I suggest that you update your Account details (click your user name at the top right of the forum) so helpers always know what Excel version(s) & platform(s) you are using as the best solution often varies by version. (Don’t forget to scroll down & ‘Save’)

20 04 21.xlsm
AB
1West Herts GC, Croxley Green, WD3 3GGWESTHE
2SAS, Skipton, BD23 2TZSASQQQ
charliew
Cell Formulas
RangeFormula
B1:B2B1=UPPER(LEFT(SUBSTITUTE(SUBSTITUTE(A1," ",""),",","QQQQQ"),6))
 
Upvote 0

Forum statistics

Threads
1,214,611
Messages
6,120,510
Members
448,967
Latest member
screechyboy79

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