Solved

# UDF Function

Posted on 2016-08-24
37 Views
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
Question by:itjockey
• 4
• 4
• 2

LVL 25

Expert Comment

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

use =trim(cell)+0
0

LVL 8

Author Comment

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

Thanks
0

LVL 25

Expert Comment

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

LVL 8

Author Comment

ID: 41768747
it wont see attached.

Thanks
Functions-For-Format.xlsx
0

LVL 28

Accepted Solution

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

In G1
``````=IF(F1="","",SUBSTITUTE(F1,CHAR(160),"")+0)
``````
and then copy down.
0

LVL 25

Assisted Solution

ProfessorJimJam earned 50 total points
ID: 41768804

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

LVL 8

Author Comment

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

Thanks
0

LVL 25

Expert Comment

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

LVL 8

Author Closing Comment

ID: 41768824
Thanks
0

LVL 28

Expert Comment

ID: 41768828
You're welcome. Glad we could help.
0

## Featured Post

### Suggested Solutions

Query output to Excel producing error 7 38
Access MDB/PDF 21 32
Excel Array formula issues 4 13
Macro to delete column 3 10
How to quickly and accurately populate Word documents with Excel data, charts and images (including Automated Bookmark generation) David Miller (dlmille) Synopsis In this article youâ€™ll learn how to use ExcelToWord! to copy data,charts, shapes â€¦
Since upgrading to Office 2013 or higher installing the Smart Indenter addin will fail. This article will explain how to install it so it will work regardless of the Office version installed.
This Micro Tutorial demonstrate the bugs in Microsoft Excel for Mac with Pivot Charts.
This Micro Tutorial will demonstrate on a Mac how to change the sort order for chart legend values and decrpyt the intimidating chart menu.