Use formulas in Lucidchart

Written by:  Morgan T
Last updated:  

Similar to how spreadsheet tools allow you to analyze, adjust, and quantify your data, Lucidchart allows you to run certain formulas on your visual diagrams and associated metadata. Read this article for general information on how to use formulas.

To see a wide variety of formulas that are available and details for how they work, see our detailed Lucid Formulas resource in the Developer Portal or post in the Lucid for Developers community space for help.

Plan availability: Free, Individual, Team, and Enterprise.

Page Insights

You can access a variety of premade formulas on your Lucidchart documents from the footer. Here you can see the number of selected objects on your page, as well as the total amount of shapes, lines, and objects on your page.

Add a formula to a shape using Page Insights

To create a shape that includes your formula, follow these instructions:

  1. Select page_insights_icon_in_lucidchart.png the Page Insights icon from the left-hand side of the footer.
  2. Hover over a page formula (Shapes, Lines, or Objects) you’d like to create a shape for.
  3. Click Visualize

General information about formulas

  • All formulas start with = or {{= 
  • Formulas can be written on the shape and in the shape data panel.
  • When the input for a formula is shape data attached to the selected shape, @ and THIS. mean the same
    • For example, =@"Name" is the same as =THIS."Name"
  • Reference key data takes preference over custom data 
    • For example, if custom data and keyed data have the same label, THIS will return the value (or an array or values) of the keyed data
  • When in doubt, put double quotes (") around the collection name, the reference key value, and all field names
    • For example, write =LOOKUP("MyData", "A01")."Name" instead of =LOOKUP(MyData, A01).Name

Formulas can call:

  • Shape data (any data attached to the current shape)
    • With custom data: {{=SUM(@customdata."Number A", @customdata."Number B")}}
    • With keyed data: {{=SUM(@"MyData"."Number A", @"MyData"."Number B")}}
  • Reference keys (any data associated with that reference key, regardless of link to shapes)
    • {{=SUM(LOOKUP("MyData", "Key 01")."NumberA",LOOKUP("MyData", "Key 02")."NumberB")}}
  • Collection data (data pulled directly from your data source) in your formulas
    • {{=SUM("MyData"!E2, "MyData"!E3)}}

Shape references quick view

Function Description
THIS A reference to the shape itself
PAGE A reference to the page
CHILDREN A reference to all child elements of the current page or shape
PARENT A reference to the parent element of the current shape
DESCENDANTS A list of all children and those children's children (and those children's children, etc.)
CONNECTED A list of references to all shapes that are connected directly to the current shape via a line
UPSTREAM A list of references to all shapes FROM which a line has been drawn TO the current shape (note: the arrows have no bearing on this)
DOWNSTREAM A list of references to all shapes TO which a line has been drawn FROM the current shape (note: the arrows have no bearing on this)
CONNECTEDDEEP A list of references to all shapes that are connected to the current shape, even through other shapes
UPSTREAMDEEP A list of references to all shapes FROM which a line has been drawn TO the current shape (note: the arrows have no bearing on this)
DOWNSTREAMDEEP A list of references to all shapes TO which a line has been drawn FROM the current shape (note: the arrows have no bearing on this)

Glossary

  • Collection: A single sheet (tab) in an imported spreadsheet data set.
  • Reference Key: The column in a collection that uniquely identifies a row. For example, each person has a unique SSN but may not have a unique name. The SSN 123-01-4567 uniquely refers to person "John Albert Smith", but the name "John Smith" could refer to thousands of people.
  • Custom Data: Shape data that is added manually, rather than referenced by a Reference Key.
  • Label and Value: Shape data comes in Label: Value pairs. For example, "Name: John Smith" has label "Name" and value "John Smith"
  • Element: Shape, line, page, group, etc. in Lucidchart
  • Keyed Values: Shape data that is reference by a Reference Key
  • Parent: The Lucidchart group to which an element belongs. Does not refer to elements upstream or downstream.
  • Child: An element of the selected group or page. Does not refer to elements upstream or downstream.
  • Descendant: The children and all of their children and all of their children, etc.

Resources

To learn more about this feature, explore the additional resources below. These resources are available in English only.

Course

Formulas in Lucid

Documents

Lucid Formulas Developer Resource

Formulas Overview Lucidchart document

Videos
 

Custom data in Lucidchart

Give feedback on this article

Have feedback about this article? Tell us about your experience here

Did you find what you were looking for?

Still have a question or want to share what you have learned? Visit our Community   to get help and collaborate with others.