Difficulty With Custom Cell Formatting

Ark68

Well-known Member
Joined
Mar 23, 2004
Messages
4,564
Office Version
  1. 365
  2. 2016
Platform
  1. Windows
I have a column of calculated cells. The formula for the cell in column A is simply (using row 93 as the example)
Code:
=B93&C93&"-"&D93

Where B93 = "4A" (value is a mix of number and alphabet), C93 = 01 (value 1, formatted as "00"), and D93 = 01 (value 1, formatted as "00").
For A93, I am looking to achieve a value of "4A01-01". But I'm only getting "4A1-1".

How would I achieve what I am looking for? Would it be to apply a custom format to the entire column? How would that custom format look?

I tried to adjust the formatting in the actual formula, but obviously it didn't work.
Code:
= B93&format(C93,"00")&"-"&format(D93,"00))

If the latter is the way to go, where did I go wrong in the formula?
 

Excel Facts

Excel Can Read to You
Customize Quick Access Toolbar. From All Commands, add Speak Cells or Speak Cells on Enter to QAT. Select cells. Press Speak Cells.
"format" is a VBA function. You should be getting a #NAME! error.

In a worksheet you have to the TEXT function instead. That will do it.
Excel Formula:
=B93&TEXT(C93,"00")&"-"&TEXT(D93,"00)
Note you also had an extra parenthesis at the end.
 
Upvote 1
Solution

Forum statistics

Threads
1,215,374
Messages
6,124,566
Members
449,171
Latest member
jominadeo

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