Difficulty With Custom Cell Formatting

Ark68

Well-known Member
Joined
Mar 23, 2004
Messages
4,616
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

Test for Multiple Conditions in IF?
Use AND(test, test, test, test) or OR(test, test, test, ...) as the logical_test argument of IF.
"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,224,823
Messages
6,181,181
Members
453,022
Latest member
Mohamed Magdi Tawfiq Emam

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