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

What does custom number format of ;;; mean?
Three semi-colons will hide the value in the cell. Although most people use white font instead.

cass108

New Member
Joined
May 14, 2002
Messages
29
Adding the VALUE function returns the digits as numeric values instead of a text string:

=VALUE(LEFT(b2,4))
 

IML

MrExcel MVP
Joined
Feb 15, 2002
Messages
1,743
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))
 

Mark W.

MrExcel MVP
Joined
Feb 10, 2002
Messages
11,654

ADVERTISEMENT

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
 

IML

MrExcel MVP
Joined
Feb 15, 2002
Messages
1,743
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!
 

Forum statistics

Threads
1,144,434
Messages
5,724,327
Members
422,544
Latest member
hpatel7

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
Top