Formulas

Generate formulas with AI to transform your data.

Overview

Generate formula with AI

To generate a formula with AI:

  1. Enter your formula instructions. Type / to insert a column reference.
  2. Click Generate formula to create your AI formula

AI formula generator examples

Here are examples of formulas you can create with the formula generator:

  1. Extract the domain from {{Email}}
  2. Use {{LinkedIn URL}} if available; otherwise use {{LinkedIn Profile}}.url
  3. Extract the text after @ in {{Twitter Handle}}
  4. Split {{city}} by comma, keep everything before the first comma, remove "Area" if present, then add quotes
  5. Extract the first word from {{Column_1}}, combine with {{Column_2}}, then remove all non-letter characters
  6. Calculate the number of days between {{Created Date}} and {{Closed Date}}

How Clay formulas work

Clay formulas are powered by Clayscript, a JavaScript-based language that evaluates expressions to transform your data. When you generate a formula with AI or write one manually, you're creating JavaScript expressions that Clay runs row-by-row.

What's available in formulas:

  • Standard JavaScript: All standard JavaScript objects and methods including Math, String, Array, Date, RegExp, Number, Object, and more.
  • Lodash: Access the full Lodash library using _ for advanced data manipulation.
  • Moment.js: Use Moment.js with moment for powerful date and time operations.
  • Excel and Google Sheets functions: Clay supports hundreds of familiar spreadsheet functions like VLOOKUP, IF, SUM, CONCATENATE, and many more through the FormulaJS library.
  • Column references: When you reference a column like {{Email}}, Clay automatically passes the value from that column into your expression.

FAQs

Can I create or change my formula without running it?

Yes! When editing a formula, you'll see the option to Save and don't run enrichments.

Clicking this prevents your formula from running on any enrichment columns that would cost credits. These columns will appear greyed out to indicate they're out of date.

Explore other docs

Web scraping

Sumble integration

Validate whether a company uses specific technologies.

View article
Export

Microsoft Teams integration

Send messages to Microsoft Teams channels directly from Clay.

View article
Enrich

EmailBison integration

Import leads into campaigns directly from Clay, ensuring accurate and efficient campaign execution.

View article

Keyboard shortcuts

Work faster in Clay with keyboard shortcuts.

View article
Export

Salesforce SOQL

The Salesforce SOQL source enables you to import records from Salesforce by writing custom queries.

View article
Transform

Share workbooks and tables as templates

Share your Clay workbooks and tables.

View article
Enrich

Zerobounce integration overview

Email validation and deliverability tools boost inbox placement and marketing ROI.

View article

Other popular resources

Experts

Find a Clay Expert

Explore our network of Clay experts and agencies

View experts
Community

Join our slack community

Find help in our slack community, and support channels

Go to slack
Cohorts

Join a cohort, learn Clay fast!

The faster way to master Clay. Sign in if you're enrolled in a cohort (current or past) or apply to an upcoming one!

Learn more about cohorts