Excel 2013 formula doesn't seem to be working

Posted on 2015-01-12
Last Modified: 2016-06-10
Driving me nuts

Please look at attched sheet and tell me why ;

           A                                            B                              C
1    Bag male female          =trim(clean(a1)             =Right(b1,6)      C1 shows------      emale  (no "f")
8    Bow tie male                =trim(clean(a8)              =Right(b8,6)       C8 shows ------       male    (1st is blank)TestMF.xlsx
Question by:lifeactuary
  • 4

Author Comment

ID: 40545535
Wht's wrong??????
LVL 37

Expert Comment

by:Neil Russell
ID: 40545551
Your text probably has a space after it.

Clean ONLY removes non printable chars.  Space is printable. Use trim instead.

Author Comment

ID: 40545606
Whew! Finally got it!

For some reason the spaces are showing as char(160).

But why didn't TRIM take care of that?
Secure Your Active Directory - April 20, 2017

Active Directory plays a critical role in your company’s IT infrastructure and keeping it secure in today’s hacker-infested world is a must.
Microsoft published 300+ pages of guidance, but who has the time, money, and resources to implement? Register now to find an easier way.


Author Comment

ID: 40545677
But I used Trim(Char...)

Could you make the correction and send it to me?

I tried using SUBSTITUTE(CHAR(32)," ") and SUBSTITUTE(CHAR(160)," ") but still having a problem.


Accepted Solution

Thymos68 earned 500 total points
ID: 40550462
Char(160) is a non-breaking space, so it's treated as a character, and not something TRIM or CLEAN will remove.

Try including a substitution of the non-breaking space (ascii 0160), with a regular space (ascii 0032)

in B1, enter the following  =CLEAN(TRIM(SUBSTITUTE(A1," "," ")))
but be sure to key-in the ascii char 160 by pressing alt-0160 for the first space, then a normal space for the second

Good luck

Author Comment

ID: 40551019
Thanks for the reply.

I found a solution by copying the column containing  the problem field into a new worksheet, doing a Text-to-Column, and then combing the result into a single cell with a space between each word,

Wonder why CLEAN doesn't remove CHAR(160)?

Thanks again.

Featured Post

Free Tool: ZipGrep

ZipGrep is a utility that can list and search zip (.war, .ear, .jar, etc) archives for text patterns, without the need to extract the archive's contents.

One of a set of tools we're offering as a way to say thank you for being a part of the community.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Suggested Solutions

Some code to ensure data integrity when using macros within Excel. Also included code that helps secure your data within an Excel workbook.
: Microsoft Office Collaborate for free and online versions of Microsoft  Word, Excel, Powerpoint, OneNote, Onedrive , Email, Calendar etc. In short we can say that Microsoft office is a suite of servers, applications and services developed by  Micr…
Viewers will learn how to maximize accessibility options in an Excel workbook for users with accessibility issues.
Viewers will learn the basics about Excel 2013’s new Flash Fill feature.

762 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question