#### Grams to ounces and ounces to grams converter

In this Excel tutorial lesson, you will learn how to convert grams to ounces and ounces to grams using the Microsoft Excel application.

## Method 1. Convert using simple multiplication

28.35 is the key number here. To convert grams to ounces, you need to just divide by 28.35. Similarly, to convert ounces to grams, you need to multiply by 28.35.

## Method 2. Conversion using CONVERT Excel function

The CONVERT function automatically converts the value based on the specified input and output units, which eliminates the need for a separate conversion factor or formula. This method is more efficient and less prone to errors, as the conversion is handled by the built-in function in Excel.

=CONVERT(cell,”unit1″,”unit2″)

## Method 3. Convert using VBA code

This VBA code will ask you how many grams you want to convert to ounces:

```Function ConvertGramsToOunces(grams As Double) As Double ConvertGramsToOunces = grams * 0.03527396 End Function Sub ConvertGramsToOuncesMain() Dim grams As Double Dim ounces As Double grams = InputBox("Enter the number of grams to convert to ounces:") If IsNumeric(grams) Then ounces = ConvertGramsToOunces(grams) MsgBox grams & " grams is equal to " & ounces & " ounces", vbInformation, "Grams to Ounces Conversion" Else MsgBox "Invalid input! Please enter a valid number.", vbExclamation, "Error" End If End Sub```

The custom functions in the Visual Basic module handle the conversion by applying the appropriate formula, which makes the conversion process easier and more efficient. This method also allows you to modify the conversion formulas if needed, by simply editing the code in the module.