#1   Report Post  
Posted to microsoft.public.excel.misc
external usenet poster
 
Posts: 468
Default Last 4 digit

Hi, i need to extract the last 4 digit from a number.
ex:
A B
0788198256 8256
But if the first number of extracted 4 is zero, i need it to be transformed
into 1.
ex:
A B
0788190248 1248

Can this be done?
Thanks!
  #2   Report Post  
Posted to microsoft.public.excel.misc
external usenet poster
 
Posts: 11,501
Default Last 4 digit

Hi,

Try this

=IF(RIGHT(A1,4)+0<1000,RIGHT(A1,4)+1000,RIGHT(A1,4 )+0)

Mike

"puiuluipui" wrote:

Hi, i need to extract the last 4 digit from a number.
ex:
A B
0788198256 8256
But if the first number of extracted 4 is zero, i need it to be transformed
into 1.
ex:
A B
0788190248 1248

Can this be done?
Thanks!

  #3   Report Post  
Posted to microsoft.public.excel.misc
external usenet poster
 
Posts: 8,520
Default Last 4 digit

=VALUE(IF(LEFT(RIGHT(A1,4),1)="0","1"&RIGHT(A1,3), RIGHT(A1,4)))

If this post helps click Yes
---------------
Jacob Skaria


"puiuluipui" wrote:

Hi, i need to extract the last 4 digit from a number.
ex:
A B
0788198256 8256
But if the first number of extracted 4 is zero, i need it to be transformed
into 1.
ex:
A B
0788190248 1248

Can this be done?
Thanks!

  #4   Report Post  
Posted to microsoft.public.excel.misc
external usenet poster
 
Posts: 60
Default Last 4 digit

With A1 containing numeric text of at least 4 characters:

This formula returns the 4 right-most chars,
converting a leading zero to 1:
B1: =MAX(LEFT(RIGHT(A1,4)),1)&RIGHT(A1,3)

Examples:
0788198256.....8256
0788190256.....1256

Note: The returned values will be text.
If you need numbers returned, try this variation:
B1: =--(MAX(LEFT(RIGHT(A1,4)),1)&RIGHT(A1,3))

Is that something you can work with?

Regards,

Ron Coderre
Microsoft MVP (Excel)
"puiuluipui" wrote in message
...
Hi, i need to extract the last 4 digit from a number.
ex:
A B
0788198256 8256
But if the first number of extracted 4 is zero, i need it to be
transformed
into 1.
ex:
A B
0788190248 1248

Can this be done?
Thanks!


  #5   Report Post  
Posted to microsoft.public.excel.misc
external usenet poster
 
Posts: 468
Default Last 4 digit

It's working very well. Thanks!

"Mike H" a scris:

Hi,

Try this

=IF(RIGHT(A1,4)+0<1000,RIGHT(A1,4)+1000,RIGHT(A1,4 )+0)

Mike

"puiuluipui" wrote:

Hi, i need to extract the last 4 digit from a number.
ex:
A B
0788198256 8256
But if the first number of extracted 4 is zero, i need it to be transformed
into 1.
ex:
A B
0788190248 1248

Can this be done?
Thanks!



  #6   Report Post  
Posted to microsoft.public.excel.misc
external usenet poster
 
Posts: 468
Default Last 4 digit

It's working very well. Thanks!

"Jacob Skaria" a scris:

=VALUE(IF(LEFT(RIGHT(A1,4),1)="0","1"&RIGHT(A1,3), RIGHT(A1,4)))

If this post helps click Yes
---------------
Jacob Skaria


"puiuluipui" wrote:

Hi, i need to extract the last 4 digit from a number.
ex:
A B
0788198256 8256
But if the first number of extracted 4 is zero, i need it to be transformed
into 1.
ex:
A B
0788190248 1248

Can this be done?
Thanks!

  #7   Report Post  
Posted to microsoft.public.excel.misc
external usenet poster
 
Posts: 468
Default Last 4 digit

It's working very well. Thanks!

"Ron Coderre" a scris:

With A1 containing numeric text of at least 4 characters:

This formula returns the 4 right-most chars,
converting a leading zero to 1:
B1: =MAX(LEFT(RIGHT(A1,4)),1)&RIGHT(A1,3)

Examples:
0788198256.....8256
0788190256.....1256

Note: The returned values will be text.
If you need numbers returned, try this variation:
B1: =--(MAX(LEFT(RIGHT(A1,4)),1)&RIGHT(A1,3))

Is that something you can work with?

Regards,

Ron Coderre
Microsoft MVP (Excel)
"puiuluipui" wrote in message
...
Hi, i need to extract the last 4 digit from a number.
ex:
A B
0788198256 8256
But if the first number of extracted 4 is zero, i need it to be
transformed
into 1.
ex:
A B
0788190248 1248

Can this be done?
Thanks!



Reply
Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes

Posting Rules

Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On


Similar Threads
Thread Thread Starter Forum Replies Last Post
conditional format on first & last digit on 3 digit cell data caprey New Users to Excel 3 December 17th 08 05:24 PM
Convert 2 digit month to 4 digit years and months BB Excel Worksheet Functions 2 September 17th 06 09:33 PM
Color a single digit in a mult-digit number cell Phyllis Excel Discussion (Misc queries) 6 November 17th 05 12:46 AM
Tell users how to sort 5 digit and 9 digit zipcodes correctly aft. [email protected] New Users to Excel 1 February 18th 05 12:59 AM
When we enter a 16 digit number (credit card) the last digit chan. ceking Excel Discussion (Misc queries) 5 December 8th 04 11:45 PM


All times are GMT +1. The time now is 04:27 AM.

Powered by vBulletin® Copyright ©2000 - 2025, Jelsoft Enterprises Ltd.
Copyright ©2004-2025 ExcelBanter.
The comments are property of their posters.
 

About Us

"It's about Microsoft Excel"