Formula for first 4 digits

Wrecker1

New Member
Joined
Sep 16, 2002
Messages
14
Is there a formula to copy the first four digits in a column to the next column?

in c2..... = ****(b2)?

Not sure how to tell it I want just the first 4 digits.
 

Excel Facts

Format cells as currency
Select range and press Ctrl+Shift+4 to format cells as currency. (Shift 4 is the $ sign).
Adding the VALUE function returns the digits as numeric values instead of a text string:

=VALUE(LEFT(b2,4))
 
Upvote 0
On 2002-09-17 10:57, cass108 wrote:
Adding the VALUE function returns the digits as numeric values instead of a text string:

=VALUE(LEFT(b2,4))

as would
=LEFT(A4,4)+0

or even dressed up a little more for error trapping:
=IF(ISNUMBER(LEFT(A4,4)+0),LEFT(A4,4)+0,LEFT(A4,4))
 
Upvote 0
This can also be done using the Data | Text to Columns... menu command after selecting your data...

1. At Step 1 of 3 choose "Fixed width" and press [ Next> ]

2. At Step 2 of 3 click in the data preview window to insert a break line after the 4th character from the left, and press [ Next> ]

3. At Step 3 of 3 set the 1st parsed column's data format as desired, set the 2nd column's format to "Do not import column (skip)", set the destination to the cell address of the 1st cell in the column where you want the data to appear, and press [ Finish ].

Voila! ...and, "Look ma', no formulas needed!" :)
This message was edited by Mark W. on 2002-09-17 12:23
 
Upvote 0
Good to know...When I first looked at this, I didn't think it would work since I expected numbers to appear as nubmers and be right justified in text to columns. I guess text to columns is correctly named!
 
Upvote 0

Forum statistics

Threads
1,214,593
Messages
6,120,434
Members
448,961
Latest member
nzskater

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