Do you need to convert values between centimetres and inches in Google Sheets?
Almost every country in the world uses the metric system of measurement. In the few countries where they use the imperial system such as the United States, you’ll often need to convert between the different types of measurements.
This post will show you how you can convert between centimetres and inches in Google Sheets.
Convert Length Between Centimeters and Inches with Multiplication Factor
Converting between centimetres and inches using a multiplication factor is easy. To convert using this method, here’s what you need to do.
Convert CM to Inches with Multiplication Factor
To convert from centimetres to inches, use the conversion factor 1 cm = 0.393701 Inch.
This means you will need to multiply 0.393701 by the length in centimetres if you want to convert it into inches.
= 0.393701 * B3
The above formula will convert the value in cell B3 into inches.
Convert Inches to CM with Multiplication Factor
Similarly, to convert from inches to centimetres, use the conversion factor 1 inch = 2.54 cm.
Multiply 2.54 by the length in inches to convert the value to centimetres.
= 2.54 * B3
The above formula will convert the value in inches from cell B3 to centimetres. Drag the formula down to get the values for the other cells.
Convert between CM and Inches with the CONVERT Function
Although the chances may be slim, it’s possible to make it when converting with the multiplication factor.
Approximation errors, and omitting or entering the wrong digit in the multiplication factor are examples of mistakes that can occur when using the conversion factor.
The CONVERT function reduces the possibility of these errors almost entirely. That is because the CONVERT function only requires that you state the unit you’re converting from and the unit into which you want to convert.
The CONVERT function uses three arguments to carry out this operation.
= CONVERT ( value, start_unit, end_unit )
value
: the number you want to convert.start_unit
: the value’s current unit of measurement.end_unit
: the unit of measurement to which you want to convert thevalue
.
The start_unit
and end_unit
arguments accept texts. As such, they must be enclosed in quotation marks.
Also, the start_unit
and end_unit
arguments only require the short or abbreviated name of the measurement’s unit.
Convert from CM to Inches with the CONVERT Function
= CONVERT ( B3, "cm", "in" )
This formula will change the value in cell B3 from centimetres to inches. Drag down the formula to convert values in the other cells to inches.
Convert from Inches to CM with the Convert Function
= CONVERT ( B3, "in", "cm")
This formula will change the value in cell B3 from inches to centimetres. Drag down the formula to convert values in the other cells to centimetres.
Convert Length Between CM and Inches with an Apps Script
Using the Apps Script, you can create a custom menu that allows you to convert between centimetres and inches seamlessly and without any hassle. All you need are a few clicks.
You will need to open the Apps Script editor window to create the app script. Go to the Extensions menu and click on Apps script.
function convertCmIn() {
var ss = SpreadsheetApp.getActiveSpreadsheet().getActiveSheet();
var selectedRange = ss.getActiveRange();
var selectedValues = selectedRange.getValues();
var selectedColumns = selectedRange.getWidth();
var selectedRows = selectedRange.getHeight();
for (i = 0; i < selectedRows; i++) {
for (j = 0; j < selectedColumns; j++) {
selectedRange.getCell(i + 1, j + 1).setValue(selectedValues[i][j] * 0.393701);
};
};
};
function convertInCm() {
var ss = SpreadsheetApp.getActiveSpreadsheet().getActiveSheet();
var selectedRange = ss.getActiveRange();
var selectedValues = selectedRange.getValues();
var selectedColumns = selectedRange.getWidth();
var selectedRows = selectedRange.getHeight();
for (i = 0; i < selectedRows; i++) {
for (j = 0; j < selectedColumns; j++) {
selectedRange.getCell(i + 1, j + 1).setValue(selectedValues[i][j] * 2.54);
};
};
};
function onOpen() {
SpreadsheetApp.getUi()
.createMenu('Convert')
.addItem('Convert CM to Inches', 'convertCmIn')
.addItem('Convert Inches to CM', 'convertInCm')
.addToUi();
};
Now, copy and paste the above script into the app script editor.
After pasting the script, click on Run. You’ll be prompted to grant some permissions before the script can run. After giving the permissions, go back to your spreadsheet and reload.
Upon reloading, the Convert custom menu will appear in the menu bar. You can use the two submenu options to convert the values between centimetres and inches.
Before using the submenus, make sure to select the values you want to convert.
⚠️ Warning: This script will overwrite the selected range with the converted values when you run it.
Conclusion
Converting between centimetres and inches is a simple task that you can perform in the spreadsheet using the multiplication factor method.
When using the multiplication factor method, you need to be familiar with the appropriate conversion factor.
If you are unsure what conversion factor to use, you can use either the CONVERT function or the custom Apps Script menu.
Do you think you will find this helpful? Let me know in the comments section!
0 Comments