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 gkittelson on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Pulling only last # in a field

Status
Not open for further replies.

jr1vas

Technical User
Nov 29, 2003
11
US
Hello,

Does anyone know how to pull only the last # within a field?

For example:

ID: 12345
ID: 123
ID: 12345678

I would like to tell the report, if the last # in this field is 5 then "....", if the last # is 8, then "...."..

Thank you for any suggestions :)
 
Assuming this is a number field :

Right(ToText({Table.ID},0,""),1)

If it's a string :

Right({Table.ID},1)

Reebo
UK

"Only two things are infinite, the universe and human stupidity, and I'm not sure about the former."
- Albert Einstein (1879-1955)
 
Try:

Switch(
Right(ToText(123456,0,""),1) = "1", "Some text for 1",
Right(ToText(123456,0,""),1) = "2", "Some text for 2",
true, "Wasn't any of the above"
)

-k
 
Thank you, let me give this a try.
 
Hi Reebo,

I tried Right({Table.ID},1)

and it worked!!! Thanks a bunch.

 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top