Returning only a portion of a number

TAG423

Board Regular
Joined
Feb 19, 2002
Messages
57
I have large numbers in one column.
2345900-4039klj
2345900-7690lgn
2345900-3670ghl
etc.....

In the next column, I only need the last four numbers with an apostrophe in front.
'4039
'7690
'3670
etc......

What is the formula for this?
 

Excel Facts

Ambidextrous Undo
Undo last command with Ctrl+Z or Alt+Backspace. If you use the Undo icon in the QAT, open the drop-down arrow to undo up to 100 steps.
If the numbers are all in the same format as those examples you can use:
="'" & mid(cell with the number),9,4)

this will take the number from that cell and take return 4 characters starting from the 9th one.

If the number formats vary you can still do it but it will be a longer formula and likely nead to use the search() and len() functions.

Dave
 
Upvote 0
On 2002-03-21 13:44, TAG423 wrote:
I have large numbers in one column.
2345900-4039klj
2345900-7690lgn
2345900-3670ghl
etc.....

In the next column, I only need the last four numbers with an apostrophe in front.
'4039
'7690
'3670
etc......

What is the formula for this?

If the data is regular as your sample shows, use:

=MID(A1,SEARCH("-",A1)+1,4)

The result is a text-formatted number.

If you need the apostrophe, use:

="'"&MID(A1,SEARCH("-",A1)+1,4)
 
Upvote 0

Forum statistics

Threads
1,214,644
Messages
6,120,709
Members
448,983
Latest member
Joaquim_Baptista

We've detected that you are using an adblocker.

We have a great community of people providing Excel help here, but the hosting costs are enormous. You can help keep this site running by allowing ads on MrExcel.com.
Allow Ads at MrExcel

Which adblocker are you using?

Disable AdBlock

Follow these easy steps to disable AdBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the icon in the browser’s toolbar.
2)Click on the "Pause on this site" option.
Go back

Disable AdBlock Plus

Follow these easy steps to disable AdBlock Plus

1)Click on the icon in the browser’s toolbar.
2)Click on the toggle to disable it for "mrexcel.com".
Go back

Disable uBlock Origin

Follow these easy steps to disable uBlock Origin

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back

Disable uBlock

Follow these easy steps to disable uBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back
Back
Top