ExcelBanter

ExcelBanter (https://www.excelbanter.com/)
-   Excel Discussion (Misc queries) (https://www.excelbanter.com/excel-discussion-misc-queries/)
-   -   Last 4 digit (https://www.excelbanter.com/excel-discussion-misc-queries/228483-last-4-digit.html)

puiuluipui

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!

Mike H

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!


Jacob Skaria

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!


Ron Coderre[_3_]

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!



puiuluipui

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!


puiuluipui

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!


puiuluipui

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!





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

Powered by vBulletin® Copyright ©2000 - 2025, Jelsoft Enterprises Ltd.
ExcelBanter.com