Name Formatter formula

Name Formatter is a custom formula in Apps Script that can be used to properly format names in a given cell or range of cells in Google Sheets. This formula can be helpful when dealing with large amounts of data where names may be inputted in various formats, such as all caps or with different casing.

Here is an example of how to create a custom formula for Name Formatter in Apps Script:

  1. Open your Google Sheet and go to the “Tools” menu, then select “Script Editor.”
  2. In the Script Editor, create a new script file and name it “Name Formatter.”
  3. In the new script file, write the following code:
function nameFormatter(name) {
  var splitName = name.split(" ");
  var formattedName = "";

  for (var i = 0; i < splitName.length; i++) {
    var word = splitName[i].toLowerCase();
    formattedName += word.charAt(0).toUpperCase() + word.slice(1) + " ";
  }

  return formattedName.trim();
}
  1. Save the script and return to your Google Sheet.
  2. In a cell where you want to use the Name Formatter formula, type =nameFormatter(A1) and replace A1 with the cell containing the name you want to format.
  3. Press enter and the cell will display the properly formatted name.

In this code, the nameFormatter function takes a name as an input parameter and returns the properly formatted name. The function splits the name into individual words, converts each word to lowercase, capitalizes the first letter of each word, and concatenates the words back together. The trim() method is used to remove any extra spaces at the beginning or end of the name.