Solved

UDF Function

Posted on 2016-08-24
10
49 Views
Last Modified: 2016-08-24
Hi Experts,

Will Anyone Help me with UDF VBA Function  code which convert text number to number.my data  have leading and trailing spaces (Spaces are not identical in characters count)so i am looking for UDF function like =Mynumber(Cell) i.e. it will remove all leading and trailing spaces.

Thanks
0
Comment
Question by:Naresh Patel
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
  • 4
  • 4
  • 2
10 Comments
 
LVL 26

Expert Comment

by:ProfessorJimJam
ID: 41768723
there is no need for UDF. built in function

use =trim(cell)+0
0
 
LVL 8

Author Comment

by:Naresh Patel
ID: 41768732
i tried that but "+0" i dint tried.....+0 Stand for?

Thanks
0
 
LVL 26

Expert Comment

by:ProfessorJimJam
ID: 41768746
when you do a math operation it will covert it to real number if the number was stored somehow in text format.

so you need to do +0  or *1  any of these can do the job.
0
Technology Partners: We Want Your Opinion!

We value your feedback.

Take our survey and automatically be enter to win anyone of the following:
Yeti Cooler, Amazon eGift Card, and Movie eGift Card!

 
LVL 8

Author Comment

by:Naresh Patel
ID: 41768747
it wont see attached.

Thanks
Functions-For-Format.xlsx
0
 
LVL 31

Accepted Solution

by:
Subodh Tiwari (Neeraj) earned 450 total points
ID: 41768784
Try this...

In G1
=IF(F1="","",SUBSTITUTE(F1,CHAR(160),"")+0)

Open in new window

and then copy down.
0
 
LVL 26

Assisted Solution

by:ProfessorJimJam
ProfessorJimJam earned 50 total points
ID: 41768804
please find attached.


=IFERROR(IF(F1<>"",SUBSTITUTE(F1,CHAR(160),""),"")+0,"")
Functions-For-Format.xlsx
0
 
LVL 8

Author Comment

by:Naresh Patel
ID: 41768813
Both Are Formula is Working ...what is the difference between each other ?

Thanks
0
 
LVL 26

Expert Comment

by:ProfessorJimJam
ID: 41768816
Neeraj formula's is better. does not need the extra IFERROR
1
 
LVL 8

Author Closing Comment

by:Naresh Patel
ID: 41768824
Thanks
0
 
LVL 31

Expert Comment

by:Subodh Tiwari (Neeraj)
ID: 41768828
You're welcome. Glad we could help.
0

Featured Post

Technology Partners: We Want Your Opinion!

We value your feedback.

Take our survey and automatically be enter to win anyone of the following:
Yeti Cooler, Amazon eGift Card, and Movie eGift Card!

Question has a verified solution.

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

You need to know the location of the Office templates folder, so that when you create new templates, they are saved to that location, and thus are available for selection when creating new documents.  The steps to find the Templates folder path are …
This article describes a serious pitfall that can happen when deleting shapes using VBA.
Excel styles will make formatting consistent and let you apply and change formatting faster. In this tutorial, you'll learn how to use Excel's built-in styles, how to modify styles, and how to create your own. You'll also learn how to use your custo…
Although Jacob Bernoulli (1654-1705) has been credited as the creator of "Binomial Distribution Table", Gottfried Leibniz (1646-1716) did his dissertation on the subject in 1666; Leibniz you may recall is the co-inventor of "Calculus" and beat Isaac…

696 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