Unlocking the Power of AI Formulas in Clay

This might be the single most important lesson in this course for maximizing the value of Clay without maximizing cost: AI formulas

AI formulas let you generate custom code in your table—credit-free—to format, clean, and reshape data exactly as needed. Too often, users rely on AI integrations instead of AI formulas in large tables, wasting hundreds or even thousands of credits. 

So in this lesson, we’ll show you how to use AI formulas to structure data and execute conditional runs so enrichments only run (and only use credits) when they meet specific criteria. 

How To Use AI Formulas and Conditional Runs in Clay

Watch the full guided demo below to learn how to use AI formulas, or skip ahead for a step-by-step breakdown.

Using AI Formulas In Clay 

AI formulas leverage Clay’s built-in AI to process and structure data. 

Clay can enrich companies and people with near-endless amounts of data, from work experience to education history to revenue and funding stage. But what if you want to concatenate company names, or string together job titles to create structured outputs, or add up the total number of educational experiences. AI formulas can do it for you, eliminating the need to manually do it yourself. 

For example, let’s say you want to know the total number of educational experiences for each person in your table. Instead of manually counting or writing complex formulas, you can use an AI formula instead. Here’s how (watch the guided demo below to follow along): 

  1. Add a new “formula” column to your table
  2. Prompt the AI to count the total number of experiences
  3. AI will generate the appropriate code to give you the desired output
  4. Save formula and it will automatically count educational experiences 

You can apply this same principle to count job experiences or total employees, concatenate company names, or string together multiple columns of data into a single output like when creating snippets for outbound email messages. The possibilities are nearly endless.

💡Tip: The AI might not always give you exactly what you're looking for on the first try. This is normal. You can iterate on your prompts, adjust the wording, or even directly modify the generated code to get the results you need. The preview feature is your friend: use it to get the right data before applying the formula.

Mastering Conditional Runs In Clay

Think of conditional runs as a core use case of AI formulas: they allow you to control when and how your enrichments run, ensuring they only run when necessary. This helps:

  • Prevent duplicate or unnecessary enrichments
  • Optimize credit usage by executing actions only when needed
  • Automatically structure and clean data in real-time

You've already used conditional runs without even knowing it: waterfalls. Waterfalls run a series of enrichments in a specific order, with each subsequent enrichment only running if the previous ones didn't return results. This is achieved through conditional formulas. 

You can modify or create your own conditional formulas however you want to build the workflows of your dreams. 

For example, let’s say you only want to find (and pay for) personal emails if a work email isn’t found first. Here’s how you can use conditional runs to do it (watch the guided demo below to follow along): 

  1. Add a new enrichment for personal emails
  2. Click on the “Use AI” button under "Run Settings"
  3. Use the AI to generate a formula that only runs if the validated work email is blank.

This ensures you're not wasting credits trying to find personal emails for contacts where you already have a work email.

Congrats!

The combination of AI formulas and conditional runs in Clay provides a powerful toolkit for data enrichment and analysis. You can extract deep insights from your data, create custom enrichment flows, and optimize your credit usage—all within the same platform.

With practice, you'll be able to create sophisticated data workflows that give you exactly the information you need, when you need it.

That’s a wrap on AI formulas. Next up, we’ll explore data cleaning and normalization in Clay. 

Data Cleaning + Normalization
Course Completed
Intro to Clay 101: FETE Framework
4 mins
Watch lesson
Current Lesson
Jigsaw Framework
4 mins
Watch lesson
Current Lesson
Find Companies
3 mins
Watch lesson
Current Lesson
Enrich Companies (Waterfalls)
4 mins
Watch lesson
Current Lesson
Enrich People (Waterfalls)
5 mins
Watch lesson
Current Lesson
Prompt Engineering Crash Course
8 mins
Watch lesson
Current Lesson
Claygent: AI Web Scraper
7 mins
Watch lesson
Current Lesson
AI Formulas + Conditional Runs
8 mins
Watch lesson
Current Lesson
Data Cleaning + Normalization
3 mins
Watch lesson
Current Lesson
Intro to Al Snippets (Copywriting)
4 mins
Watch lesson
Current Lesson
Lead Scoring
7 mins
Watch lesson
Current Lesson
Push Data To Your CRM
5 mins
Watch lesson
Current Lesson
Push Data To Your Email Sequencer
4 mins
Watch lesson
Current Lesson
Download as a CSV
3 mins
Watch lesson
Current Lesson
Import from CRM
3 mins
Watch lesson
Current Lesson
Google Sheets
6 mins
Watch lesson
Current Lesson
Find Local Businesses Using Google Maps
3 mins
Watch lesson
Current Lesson
Find Company Lookalikes
7 mins
Watch lesson
Current Lesson
Find Jobs Source + Enrichment
5 mins
Watch lesson
Current Lesson
Write to Table
6 mins
Watch lesson
Current Lesson
Closing Remarks
2 mins
Watch lesson
Current Lesson

Connect, explore and learn together

Read our GTM blog, or try out our top Claybooks and templates to transform your growth ideas into outreach in minutes.

Clay branded illustration of a wall made out of 3D, colourful, clay bricks and a whimsical person opening a door in the wall to access a new world of opportunities.

Clay University

Master Clay in a few core lessons. Uplevel your data enrichment, craft better outbound messages, and book more meetings.

Learn with Clay

Go to market blog

Our best content on growing your GTM motion, from outbound sales automation to AI lead generation.

Explore our blog
Clay branded illustration made out of 3D clay objects showing  whimsical operators connecting cables to 3D Clay table

Integrations

Browse through all the integrations you can connect to Clay in seconds and discover what you can do!

Explore integrations
Clay branded illustration of a Clay table with colourful, 3D connectors made out of Clay around it

Templates

Power your outbound campaigns with our best templates.

Visit clay templates
Clay branded illustration of a messy tangle of 3D, colourful strings made out of clay being untangled into one, colourful, twisted string

Clay Experts

Hire a Clay Enterprise expert or find a Clay partner to help with your next project

Explore Clay experts

Clay's Chrome extension

Clay’s Chrome Extension makes it wicked easy to find leads almost anywhere on the internet

Explore Chrome Extension