REMOVING LEADING ZERO

J

Jessica

I have loan numbers that consist of all numbers or alphanumeric fields. Not
all loan numbers have the same digits, however, they are all formatted to 35
character spaces. For example, one loan might be 123 (with zeros in front)
and another loan would be 1245523, and another could be 1234abc1345. I need
to format those with only numbers to a number value. I have used the Val()
function and it works perfect with only number values, but when there is a
loan that have alphanumeric, it shows up as 0. How do it have it show the
loan number with the text? For example loan 00000abc123 needs to read abc123.
 
K

KARL DEWEY

You can nest IIFs like this --
IIf(left([loan number],1)<>"0",[loan number], Iif(mid([loan
number],2,1)<>"0",mid([loan number],2),iif(mid([loan
number],3,1)<>"0",mid([loan number],3),"xxx"))) AS Expr1

You will need as many layers as you might have leading zeros.
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Similar Threads


Top