In the last post, we talked about Excel Worksheet and Workbook. In this post, we shall learn about formatting and doing other formatting activities related with cells of Excel worksheet.
The default data type of any cell in excel is 'General', to prove this write any numeric data in a cell like this.
Now right click that cell and select 'Format Cells...' or simply press CTRL+1 (1 should not be pressed from numberic key pad).
and this shows a Format Cells dialog box. Notice below dialog box picture and see that Category list has 'General' selected by default.
This means that any cell of the Excel worksheet can accept any type of data and all are treated as string (however mathematical operations may parse the string to integer automatically).
To format data into Number Formats, we can use either 'Number' group from the Ribbon as displayed in below picture or Number, Currency and Accounting category from the Number tab of Format Cells dialog box (as displayed above).
For example to keep decimal characters after a number, we can use 'Increase Decimal' icon from the Ribbon group.
Same as above we can also use 'Decrease Decimal' to decrease the decimal characters.
We can also use other icons from the group for Percent style, Comma Style, Accounting Number Format.
Apart from Toolbar Icons, we can also use Format Cells dialog box to achieve same thing.
To change the color of the cells, first select the cell and then use Font group icons as displayed below. To change the background color, use Fill color icon and to change the font color use Font Color toolbar icon.
Apart from using Toolbar icons, we can also use Format Cells dialog box and select Font tab. Look at the picture below.
We can also achieve following formatting using this
To change the border style of the cell, select the cells we want to format and then click on the Border icon dropdown and then select the border style we want to apply.
In this case, the applied border looks like this.
Instead of following above steps, we can do border formatting using Format Cells dialog box and select Border tab and select desired border.
To copy the format of a cell to other cells, we can use 'Format Painter' icon from the Ribbon.
First select the cell you want to copy the format from and then click on 'Format Painter' icon as displayed above.
The mouse icon changes like below. Now select the target cells you want to paste the format into.
and the result looks like below.
To clear the formatting of the cells, first select the cells you want to clear format from. Now click on the Clear icon from Editing group on the Ribbon as displayed in the picture below and click on 'Clear Formats'. This clears the format of the cell.
To clear the cell formats including the cell data, click on 'Clear All'.
This also helps in following