- For individual users
- Instant access to solutions
- Ask your tech questions
- Start your 30-day Free Trial
Main Topics
Browse All TopicsYesterday I thought I understood isblank, but I was wrong.
Today I am 100% sure I really really understand it which means I'm sure to be wrong again.
Will someone just check this out and see if there are any glaring errors?
When cutting peoples names from a web page and pasting into excel, the result often has blanks at the end of the text.
I always fix this up by trimming the names.
To illustrate this, type the following into these cells
a1 John Doe
a2 John Doe (followed by 5 blanks)
a3 (don't type anything, leave it blank)
a4 x
a5 x
c1 = len(a1)
copy c1 and paste in c1:d5
e1 = IF(ISBLANK(A1),CELL("addre
copy e1 and paste in e1:f5
You will see that len(a2) is 13 because of the 5 blanks
I usually fix this by
inserting =trim(a1) into cell b1,
dragging b1 to b5
copy b1:b5 to clipboard
paste > special > values into a1:a5
I thought this was perfect, but (alas) i was wrong.
Notice that a3, which started out IS BLANK, is no longer blank.
Also notice a3 still is length 0.
finally notice that selecting a1 then doing a ctrl down arrow does not stop at the first blank cell, because it is not really blank.
You can repeat this by selecting a3 and hitting the delete key on keyboard.
Question #1 can I fix this without resorting to vba? (I tried =IF(ISBLANK(A3),"",TRIM(A3
Question #2 is there a way of telling Excel to automatically delete trailing blanks from every data entry, import, or cut and paste?
Question #3 I believe that worksheet function ISBLANK is 100% equivalent to vba function ISEMPTY. In other words, Bill Gates simply misnamed it. Am I correct, or is there something subtle that I am missing?
Question #4 I believe that the following vba line accomplish exactly the same thing. Am I missing something subtle?
mycell.formula = ""
mycell.formula = null
rberke
p.s. --------------------------
To fix this, I have resorted to the following, but i don't like it because it resets the Undo chain. I use Undo a lot, especially when I am cutting and pasting this junk.
sub myChangeToValue()
for each cl in selection.cells
cl.value = rtrim(cl.value)
next cl
end sub
This question has been solved and asker verified All Experts Exchange premium technology solutions are available to subscription members.
Experts Exchange has been collecting answers to technology questions since 1996…3 million and counting! If you have a question, chances are we already have your answer.
If you can't find the exact answer you're looking for, ask our exclusive community of 50,000 experts. You’ll get a personalized answer from a trusted professional.
Thousands of free tech tips, tricks, how-to’s and tutorials are available in our peer reviewed articles section. See for yourself how smart our experts are, no login required.
Access the answers to your technology questions today.
30-day free trial. Register in 60 seconds.
Members of the expert community talk about why the experience at Experts Exchange is different than what you will find anywhere else.

Try it out and discover for yourself.
30-day free trial. Register in 60 seconds.
Join the community of experts here and help other tech pros by answering question in your area of expertise. You can earn FREE access to all Experts Exchange's premium features and resources.
Business Accounts
Answer for Membership