How to I format a number to text?

gkisystems

Board Regular
Joined
Apr 20, 2012
Messages
76
I need to format my product item codes (SKU's) as text for my vlookup to work. Some SKU's are strictly whole numbers, some are numbers with decimal points, and some are numbers and letters.

For example, I have a list of several hundred SKU's that look like this:

4116325488</SPAN>

<TBODY>
</TBODY><COLGROUP><COL></COLGROUP>
CL.272</SPAN>

<TBODY>
</TBODY><COLGROUP><COL></COLGROUP>
FV.3715LB</SPAN>

<TBODY>
</TBODY><COLGROUP><COL></COLGROUP>
G4611.21</SPAN>

<TBODY>
</TBODY><COLGROUP><COL></COLGROUP>
L37646-LBV</SPAN>

<TBODY>
</TBODY><COLGROUP><COL></COLGROUP>
CDA911.P134</SPAN>

<TBODY>
</TBODY><COLGROUP><COL></COLGROUP>
4116325488.01</SPAN>

<TBODY>
</TBODY><COLGROUP><COL></COLGROUP>

I tried using =TEXT(cell_number_here,"#.##") and the formula works fine except for whole number SKU's without a decimal point such as 4116325488. For that SKU, the format results in:

4116325488.

with the period at the end of the number. What formula would work so I do not get the period at the end of the whole number SKU's?
 

Some videos you may like

Excel Facts

Pivot Table Drill Down
Double-click any number in a pivot table to create a new report showing all detail rows that make up that number

rob.barnes01

Board Regular
Joined
Aug 26, 2010
Messages
94
Try this:

Code:
=IF(NOT(ISNUMBER(FIND(".",A1,1))),TEXT(A1,"#"),TEXT(A1,"#.##"))

Hope this helps.
 

T. Valko

Well-known Member
Joined
May 9, 2009
Messages
16,623
I need to format my product item codes (SKU's) as text for my vlookup to work. Some SKU's are strictly whole numbers, some are numbers with decimal points, and some are numbers and letters.

For example, I have a list of several hundred SKU's that look like this:

4116325488</SPAN>

<TBODY>
</TBODY>
CL.272</SPAN>

<TBODY>
</TBODY>
FV.3715LB</SPAN>

<TBODY>
</TBODY>
G4611.21</SPAN>

<TBODY>
</TBODY>
L37646-LBV</SPAN>

<TBODY>
</TBODY>
CDA911.P134</SPAN>

<TBODY>
</TBODY>
4116325488.01</SPAN>

<TBODY>
</TBODY>

I tried using =TEXT(cell_number_here,"#.##") and the formula works fine except for whole number SKU's without a decimal point such as 4116325488. For that SKU, the format results in:

4116325488.

with the period at the end of the number. What formula would work so I do not get the period at the end of the whole number SKU's?
You can convert numeric numbers to TEXT numbers like this:

A1 = 12345

=A1&""
 

Watch MrExcel Video

Forum statistics

Threads
1,122,481
Messages
5,596,391
Members
414,063
Latest member
N_Bates

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