How to ensure that an Excel table is properly formatted, both in values and background?

Mr. Snrub

Board Regular
Joined
May 22, 2005
Messages
150
Office Version
  1. 365
Platform
  1. Windows
As I understand it, an Excel table can only be formatted at the time it's created. If you want to change the number format of a column, you have to convert it to a Range, and then convert it back to a table. The problem with this is once you turn it to a range, the background colors of your table get applied to the cells. Then when you convert it back to a table, you've got the formatting of the table, plus the background colors of the cells. This is unnecessary overhead, and also if you try to fill down any values in the cells, you'll get the same background color of the first cell you fill. This is bad! I feel like what I need to do to fix all this is the following:

1. Copy-and-paste the Values And Number Formatting of the entire table to an unused and unformatted area of the worksheet.
2. Ensure that all the recently-pasted cells in the new area are the correct number formats so that new rows will have the correct formats.
3. Select the cells of the new table and format it as a table. Keeping the default name Table1.
4. Rename the original excel table to a temp value, such as GarbageTable.
5. Rename the new excel table from Table1 to whatever the original correct table name is.
6. Delete the original GarbageTable's cells such that the new table occupies the same space as the original table did.

This will be very time-consuming for a workbook with multiple tables. Is there a better approach?
 

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
You can select numbers in a excel table and format them, change the cell format from general to number. Are you talking about something else?
 
Upvote 0
If you create a new row in the excel table it will NOT adopt the number formatting of the last row. Instead it will adopt the formatting of whatever the last row's cells were when the table was created.
 
Upvote 0
I create this

Excel 2010[TABLE="class: grid, width: 350"]
<colgroup><col><col><col><col><col></colgroup><tbody>[TR="bgcolor: [URL=https://www.mrexcel.com/forum/usertag.php?do=list&action=hash&hash=DAE7F5]#DAE7F5[/URL] "]
[TD][/TD]
[TD]A[/TD]
[TD]B[/TD]
[TD]C[/TD]
[TD]D[/TD]
[/TR]
[TR]
[TD="align: center"]1[/TD]
[TD]Header1[/TD]
[TD]Header2[/TD]
[TD]Header3[/TD]
[TD]Header4[/TD]
[/TR]
[TR]
[TD="align: center"]2[/TD]
[TD]DATA1[/TD]
[TD="align: right"]6919[/TD]
[TD="align: right"]1283[/TD]
[TD="align: right"]3179[/TD]
[/TR]
[TR]
[TD="align: center"]3[/TD]
[TD]DATA2[/TD]
[TD="align: right"]1586[/TD]
[TD="align: right"]6312[/TD]
[TD="align: right"]7777[/TD]
[/TR]
[TR]
[TD="align: center"]4[/TD]
[TD]DATA3[/TD]
[TD="align: right"]6719[/TD]
[TD="align: right"]3068[/TD]
[TD="align: right"]1137[/TD]
[/TR]
[TR]
[TD="align: center"]5[/TD]
[TD]DATA4[/TD]
[TD="align: right"]1656[/TD]
[TD="align: right"]1407[/TD]
[TD="align: right"]1400[/TD]
[/TR]
[TR]
[TD="align: center"]6[/TD]
[TD]DATA5[/TD]
[TD="align: right"]7422[/TD]
[TD="align: right"]7456[/TD]
[TD="align: right"]3364[/TD]
[/TR]
[TR]
[TD="align: center"]7[/TD]
[TD]DATA6[/TD]
[TD="align: right"]5172[/TD]
[TD="align: right"]7298[/TD]
[TD="align: right"]1510[/TD]
[/TR]
[TR]
[TD="align: center"]8[/TD]
[TD]DATA7[/TD]
[TD="align: right"]5343[/TD]
[TD="align: right"]33[/TD]
[TD="align: right"]314[/TD]
[/TR]
[TR]
[TD="align: center"]9[/TD]
[TD]DATA8[/TD]
[TD="align: right"]6378[/TD]
[TD="align: right"]129[/TD]
[TD="align: right"]5170[/TD]
[/TR]
</tbody>[/TABLE]
Sheet7



After tuning it into a table I select B2:B9 and format as number with 2 decimal places and thousand separate. When I add another row and get the number format in that column.

Excel 2010[TABLE="class: grid, width: 350"]
<colgroup><col><col><col><col><col></colgroup><tbody>[TR="bgcolor: [URL=https://www.mrexcel.com/forum/usertag.php?do=list&action=hash&hash=DAE7F5]#DAE7F5[/URL] "]
[TD][/TD]
[TD]A[/TD]
[TD]B[/TD]
[TD]C[/TD]
[TD]D[/TD]
[/TR]
[TR]
[TD="align: center"]1[/TD]
[TD]Header1[/TD]
[TD]Header2[/TD]
[TD]Header3[/TD]
[TD]Header4[/TD]
[/TR]
[TR]
[TD="align: center"]2[/TD]
[TD]DATA1[/TD]
[TD="align: right"]6,919.00[/TD]
[TD="align: right"]1283[/TD]
[TD="align: right"]3179[/TD]
[/TR]
[TR]
[TD="align: center"]3[/TD]
[TD]DATA2[/TD]
[TD="align: right"]1,586.00[/TD]
[TD="align: right"]6312[/TD]
[TD="align: right"]7777[/TD]
[/TR]
[TR]
[TD="align: center"]4[/TD]
[TD]DATA3[/TD]
[TD="align: right"]6,719.00[/TD]
[TD="align: right"]3068[/TD]
[TD="align: right"]1137[/TD]
[/TR]
[TR]
[TD="align: center"]5[/TD]
[TD]DATA4[/TD]
[TD="align: right"]1,656.00[/TD]
[TD="align: right"]1407[/TD]
[TD="align: right"]1400[/TD]
[/TR]
[TR]
[TD="align: center"]6[/TD]
[TD]DATA5[/TD]
[TD="align: right"]7,422.00[/TD]
[TD="align: right"]7456[/TD]
[TD="align: right"]3364[/TD]
[/TR]
[TR]
[TD="align: center"]7[/TD]
[TD]DATA6[/TD]
[TD="align: right"]5,172.00[/TD]
[TD="align: right"]7298[/TD]
[TD="align: right"]1510[/TD]
[/TR]
[TR]
[TD="align: center"]8[/TD]
[TD]DATA7[/TD]
[TD="align: right"]5,343.00[/TD]
[TD="align: right"]33[/TD]
[TD="align: right"]314[/TD]
[/TR]
[TR]
[TD="align: center"]9[/TD]
[TD]DATA8[/TD]
[TD="align: right"]6,378.00[/TD]
[TD="align: right"]129[/TD]
[TD="align: right"]5170[/TD]
[/TR]
[TR]
[TD="align: center"]10[/TD]
[TD]data9[/TD]
[TD="align: right"]66.00[/TD]
[TD="align: right"]5[/TD]
[TD="align: right"]9[/TD]
[/TR]
</tbody>[/TABLE]
Sheet7

As you can see I get 66.00 instead of 66 since the cell is formatted as a number. I am unable to recreate the behavior you are seeing. Maybe someone else can.
 
Upvote 0

Forum statistics

Threads
1,223,894
Messages
6,175,254
Members
452,623
Latest member
Techenthusiast

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