Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations Chris Miller on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Easy formula 1

Status
Not open for further replies.

rhoneyfi

MIS
Apr 8, 2002
200
US
I need a formula that does the following:

It looks at a numeric field, ignores the first two numbers, and returns the remaining numbers.

Ex: Account number = 77100035

Formula would return : 100035

I know the formula is easy....programming is still pretty new to me. Thanks
 
Here is one way (replace {your.field} with the field you are converting)

right(totext({your.field},0,""),length(totext({your.field},0,""))-2)




Mike
 
Here's two other options that would return what you are looking for -

//TRIM FIRST TWO NUMBERS//

ToNumber (Mid (Replace (ToText ({field}),",",""),3))

NOTE : This returns a NUMBER, but would take 1002 and make it 2, the leading 0 will be auto-trimmed.

--------------------------------

//TRIM FIRST TWO NUMBERS STRING//

Replace (Mid (Replace (ToText ({field}),",",""),3),".00","")

NOTE : This returns a STRING, but would take 1002 and make it 02.
 
hi
create formula cal it @TrimNumber
inside type this

mid({yourFirld},2,6)




----------

Note

2 means what position to start getting the number from left to right
6 means how many number after the first 2 digit

cheers

pgtek
 
Why not just the following?

mid(totext({table.acctno},0,""),3)

-LB
 
I'd go with a version of pgteks:

mid({table.field},3)

Note that the last parameter in the mid is optional, so if the numebr varies in loength in the future, you wouldn't want to hardcode the length.

-k
 
Ooops, forgot to allow for if it's a numeric data type:

Looks like lbass had it though.

-k
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top