{"id":4794,"date":"2026-04-09T13:20:19","date_gmt":"2026-04-09T17:20:19","guid":{"rendered":"https:\/\/health.uconn.edu\/clinical-research-center\/?page_id=4794"},"modified":"2026-04-09T16:34:04","modified_gmt":"2026-04-09T20:34:04","slug":"redcap-calculated-fields","status":"publish","type":"page","link":"https:\/\/health.uconn.edu\/clinical-research-center\/services\/informatics-core\/redcap\/guides-how-tos\/redcap-logic-hub\/redcap-calculated-fields\/","title":{"rendered":"REDCap Calculated Fields"},"content":{"rendered":"<div class=\"in-page-tabs\"><ul id=\"menu-redcap\" class=\"menu nav nav-tabs\"><li id=\"menu-item-4437\" class=\"menu-item menu-item-type-post_type menu-item-object-page\"><a href=\"https:\/\/health.uconn.edu\/clinical-research-center\/services\/informatics-core\/redcap\/uch-redcap-user-agreement\/\">REDCap User Agreement<\/a><\/li><li id=\"menu-item-4440\" class=\"menu-item menu-item-type-post_type menu-item-object-page\"><a href=\"https:\/\/health.uconn.edu\/clinical-research-center\/services\/informatics-core\/redcap\/redcap-fees\/\">REDCap Fees<\/a><\/li><li id=\"menu-item-4438\" class=\"menu-item menu-item-type-post_type menu-item-object-page\"><a href=\"https:\/\/health.uconn.edu\/clinical-research-center\/services\/informatics-core\/redcap\/redcap-usage\/\">REDCap Usage<\/a><\/li><li id=\"menu-item-4441\" class=\"menu-item menu-item-type-post_type menu-item-object-page\"><a href=\"https:\/\/health.uconn.edu\/clinical-research-center\/services\/informatics-core\/redcap\/redcap-account-request\/\">REDCap Account Request<\/a><\/li><li id=\"menu-item-4446\" class=\"menu-item menu-item-type-post_type menu-item-object-page menu-item-has-children dropdown\"><a href=\"https:\/\/health.uconn.edu\/clinical-research-center\/redcap-login-issues\/\" class=\"dropdown-toggle\" data-toggle=\"dropdown\">REDCap Login Issues<b class=\"caret\"><\/b><\/a>\n<ul class=\"dropdown-menu\">\n\t<li id=\"menu-item-4447\" class=\"menu-item menu-item-type-post_type menu-item-object-page\"><a href=\"https:\/\/health.uconn.edu\/clinical-research-center\/redcap-login-issues\/uchc-user\/\">REDCap Login Help for UConn Health Users<\/a><\/li>\t<li id=\"menu-item-4448\" class=\"menu-item menu-item-type-post_type menu-item-object-page\"><a href=\"https:\/\/health.uconn.edu\/clinical-research-center\/redcap-login-issues\/external-user\/\">UConn &amp; External Users Login Issues<\/a><\/li><!--.dropdown-->\n<\/ul>\n<\/li><li id=\"menu-item-4443\" class=\"menu-item menu-item-type-post_type menu-item-object-page\"><a href=\"https:\/\/health.uconn.edu\/clinical-research-center\/services\/informatics-core\/redcap\/guides-how-tos\/\">REDCap Guides &amp; How-to<\/a><\/li><li id=\"menu-item-4920\" class=\"menu-item menu-item-type-post_type menu-item-object-page\"><a href=\"https:\/\/health.uconn.edu\/clinical-research-center\/data-management\/\">Data Management<\/a><\/li><li id=\"menu-item-4449\" class=\"menu-item menu-item-type-post_type menu-item-object-page menu-item-has-children dropdown\"><a href=\"https:\/\/health.uconn.edu\/clinical-research-center\/services\/informatics-core\/redcap\/scheduled-maintenance\/\" class=\"dropdown-toggle\" data-toggle=\"dropdown\">REDCap Maintenance<b class=\"caret\"><\/b><\/a>\n<ul class=\"dropdown-menu\">\n\t<li id=\"menu-item-4678\" class=\"menu-item menu-item-type-post_type menu-item-object-page\"><a href=\"https:\/\/health.uconn.edu\/clinical-research-center\/services\/informatics-core\/redcap\/scheduled-maintenance\/\">REDCap Maintenance<\/a><\/li>\t<li id=\"menu-item-4450\" class=\"menu-item menu-item-type-post_type menu-item-object-page\"><a href=\"https:\/\/health.uconn.edu\/clinical-research-center\/services\/informatics-core\/redcap\/scheduled-maintenance\/new-features-improvements\/\">REDCap Upgrade Details<\/a><\/li><!--.dropdown-->\n<\/ul>\n<\/li><li id=\"menu-item-4442\" class=\"menu-item menu-item-type-post_type menu-item-object-page\"><a href=\"https:\/\/health.uconn.edu\/clinical-research-center\/services\/informatics-core\/redcap\/redcap-training\/\">REDCap Training Center<\/a><\/li><li id=\"menu-item-4451\" class=\"menu-item menu-item-type-post_type menu-item-object-page\"><a href=\"https:\/\/health.uconn.edu\/clinical-research-center\/services\/informatics-core\/redcap\/redcap-systems\/\">REDCap Systems<\/a><\/li><li id=\"menu-item-4453\" class=\"menu-item menu-item-type-post_type menu-item-object-page\"><a href=\"https:\/\/health.uconn.edu\/clinical-research-center\/services\/informatics-core\/redcap\/citing-redcap\/\">Citing REDCap<\/a><\/li><li id=\"menu-item-4455\" class=\"menu-item menu-item-type-post_type menu-item-object-page\"><a href=\"https:\/\/health.uconn.edu\/clinical-research-center\/services\/informatics-core\/redcap\/redcap_news\/\">REDCap News You Can Use<\/a><\/li><\/ul><\/div><div id=\"top\" class=\"redcap-calculated-fields-guide\" style=\"max-width: 1100px;margin: 0 auto;line-height: 1.7;color: #1f2937\">\n<h1 style=\"margin-bottom: 6px\">A Practical Guide to Scoring, Dates, and Dynamic Values<\/h1>\n<h2 style=\"font-size: 1.08em;margin-top: 0\"><strong><br \/>\nAutomatically calculate values based on data entered in your project<\/strong><\/h2>\n<p>Calculated fields allow REDCap to automatically compute values in real time using data from other fields. They are commonly used for scoring instruments, calculating age or time intervals, and generating derived variables for analysis.<\/p>\n<div style=\"background: #eff6ff;border-left: 6px solid #2563eb;padding: 14px;margin: 22px 0;border-radius: 4px\"><strong>Core Principle:<\/strong> Calculated fields always return a <strong>numeric value<\/strong> based on a formula using other fields.<\/div>\n<div style=\"background: #fff7ed;border-left: 6px solid #ea580c;padding: 14px;margin: 22px 0;border-radius: 4px\"><strong>&#x26a0;&#xfe0f; Important:<\/strong> Calculated values are not automatically saved for existing records when you change a formula. You must run <strong>Data Quality Rule H<\/strong> to update stored values.<\/div>\n<p><!-- TOC --><\/p>\n<div style=\"background: #f0f9ff;border: 1px solid #bae6fd;padding: 16px;border-radius: 6px;margin: 24px 0\">\n<p><strong>On this page<\/strong><\/p>\n<ul style=\"margin: 10px 0 0 20px\">\n<li><a href=\"#what\">What Calculated Fields Do<\/a><\/li>\n<li><a href=\"#syntax\">Calculation Syntax<\/a><\/li>\n<li><a href=\"#functions\">Common Functions<\/a><\/li>\n<li><a href=\"#sum\">sum() vs +<\/a><\/li>\n<li><a href=\"#dates\">Working with Dates<\/a><\/li>\n<li><a href=\"#checkbox\">Checkbox Calculations<\/a><\/li>\n<li><a href=\"#real-world\">Real-World Examples<\/a><\/li>\n<li><a href=\"#ruleh\">Updating Values (Rule H)<\/a><\/li>\n<li><a href=\"#mistakes\">Common Mistakes<\/a><\/li>\n<li><a href=\"#best\">Best Practices<\/a><\/li>\n<li><a href=\"#checklist\">Quick Checklist<\/a><\/li>\n<\/ul>\n<\/div>\n<hr \/>\n<h2 id=\"what\" style=\"background: #329EB8;color: white;padding: 12px;border-radius: 6px\">What Calculated Fields Do<\/h2>\n<ul>\n<li>Automatically compute scores<\/li>\n<li>Calculate age or time differences<\/li>\n<li>Generate derived variables<\/li>\n<li>Reduce manual calculation errors<\/li>\n<\/ul>\n<div style=\"background: #f0fdf4;border-left: 6px solid #16a34a;padding: 12px;margin: 16px 0\"><strong>&#x2705; Best Practice:<\/strong> Use calculated fields for simple, real-time calculations\u2014not complex data processing.<\/div>\n<div style=\"text-align: right;margin-top: 14px\"><a href=\"#top\" style=\"background: #eef6f8;color: #1f2937;padding: 6px 12px;text-decoration: none;border-radius: 20px;font-size: 0.95em\">Back to top \u2191<\/a><\/div>\n<hr \/>\n<h2 id=\"syntax\" style=\"background: #329EB8;color: white;padding: 12px;border-radius: 6px\">Calculation Syntax<\/h2>\n<p>Basic format:<\/p>\n<pre>[field1] + [field2]<\/pre>\n<p>Examples:<\/p>\n<pre>[bp_sys] + [bp_dia]\r\n[bmi_weight] \/ ([height]^2)\r\nif([age] &gt; 65, 1, 0)\r\n<\/pre>\n<div style=\"background: #eff6ff;border-left: 6px solid #2563eb;padding: 12px\"><strong>Tip:<\/strong> Use square brackets for all variables.<\/div>\n<div style=\"text-align: right;margin-top: 14px\"><a href=\"#top\" style=\"background: #eef6f8;color: #1f2937;padding: 6px 12px;text-decoration: none;border-radius: 20px;font-size: 0.95em\">Back to top \u2191<\/a><\/div>\n<hr \/>\n<h2 id=\"functions\" style=\"background: #329EB8;color: white;padding: 12px;border-radius: 6px\">Common Functions<\/h2>\n<ul>\n<li><code>sum()<\/code><\/li>\n<li><code>mean()<\/code><\/li>\n<li><code>min()<\/code>, <code>max()<\/code><\/li>\n<li><code>round()<\/code><\/li>\n<li><code>if()<\/code><\/li>\n<\/ul>\n<pre>sum([q1],[q2],[q3])\r\nround([value],1)\r\nif([score] &gt; 10, 1, 0)\r\n<\/pre>\n<div style=\"text-align: right;margin-top: 14px\"><a href=\"#top\" style=\"background: #eef6f8;color: #1f2937;padding: 6px 12px;text-decoration: none;border-radius: 20px;font-size: 0.95em\">Back to top \u2191<\/a><\/div>\n<hr \/>\n<h2 id=\"sum\" style=\"background: #329EB8;color: white;padding: 12px;border-radius: 6px\">sum() vs +<\/h2>\n<table style=\"width: 100%;border-collapse: collapse\">\n<tbody>\n<tr>\n<th style=\"border: 1px solid #ccc;padding: 8px\">Method<\/th>\n<th style=\"border: 1px solid #ccc;padding: 8px\">Behavior<\/th>\n<\/tr>\n<tr>\n<td style=\"border: 1px solid #ccc;padding: 8px\">+<\/td>\n<td style=\"border: 1px solid #ccc;padding: 8px\">Fails if any field is blank<\/td>\n<\/tr>\n<tr>\n<td style=\"border: 1px solid #ccc;padding: 8px\">sum()<\/td>\n<td style=\"border: 1px solid #ccc;padding: 8px\">Ignores blanks<\/td>\n<\/tr>\n<\/tbody>\n<\/table>\n<div style=\"background: #fff7ed;border-left: 6px solid #ea580c;padding: 12px\"><strong>&#x26a0;&#xfe0f; Important:<\/strong> Choose based on scoring rules.<\/div>\n<div style=\"text-align: right;margin-top: 14px\"><a href=\"#top\" style=\"background: #eef6f8;color: #1f2937;padding: 6px 12px;text-decoration: none;border-radius: 20px;font-size: 0.95em\">Back to top \u2191<\/a><\/div>\n<hr \/>\n<h2 id=\"dates\" style=\"background: #329EB8;color: white;padding: 12px;border-radius: 6px\">Working with Dates<\/h2>\n<pre>datediff([dob],[visit_date],\"y\")\r\ndatediff(\"today\",[visit_date],\"d\")\r\n<\/pre>\n<ul>\n<li>y = years<\/li>\n<li>d = days<\/li>\n<li>M = months<\/li>\n<\/ul>\n<div style=\"background: #fff7ed;border-left: 6px solid #ea580c;padding: 12px\"><strong>&#x26a0;&#xfe0f; Important:<\/strong> \u201ctoday\u201d updates each time the record is opened.<\/div>\n<div style=\"text-align: right;margin-top: 14px\"><a href=\"#top\" style=\"background: #eef6f8;color: #1f2937;padding: 6px 12px;text-decoration: none;border-radius: 20px;font-size: 0.95em\">Back to top \u2191<\/a><\/div>\n<hr \/>\n<h2 id=\"checkbox\" style=\"background: #329EB8;color: white;padding: 12px;border-radius: 6px\">Checkbox Calculations<\/h2>\n<pre>if([exercise(1)] = 1, 1, 0)\r\n<\/pre>\n<div style=\"background: #fef2f2;border-left: 6px solid #dc2626;padding: 12px\"><strong>&#x26a0;&#xfe0f; Important:<\/strong> Checkbox values are binary (0\/1), not choice codes.<\/div>\n<div style=\"text-align: right;margin-top: 14px\"><a href=\"#top\" style=\"background: #eef6f8;color: #1f2937;padding: 6px 12px;text-decoration: none;border-radius: 20px;font-size: 0.95em\">Back to top \u2191<\/a><\/div>\n<hr \/>\n<h2 id=\"real-world\" style=\"background: #329EB8;color: white;padding: 12px;border-radius: 6px\">Real-World Examples<\/h2>\n<div style=\"flex-wrap: wrap;gap: 20px\">\n<div style=\"flex: 1;min-width: 250px;border: 1px solid #ccc;padding: 12px;border-radius: 6px\">\n<p><strong>Total Score<\/strong><\/p>\n<pre>sum([q1],[q2],[q3],[q4])<\/pre>\n<\/div>\n<div style=\"flex: 1;min-width: 250px;border: 1px solid #ccc;padding: 12px;border-radius: 6px\">\n<p><strong>Age<\/strong><\/p>\n<pre>datediff([dob],\"today\",\"y\")<\/pre>\n<\/div>\n<div style=\"flex: 1;min-width: 250px;border: 1px solid #ccc;padding: 12px;border-radius: 6px\">\n<p><strong>Eligibility Flag<\/strong><\/p>\n<pre>if([age] &gt; 18,1,0)<\/pre>\n<\/div>\n<\/div>\n<div style=\"text-align: right;margin-top: 14px\"><a href=\"#top\" style=\"background: #eef6f8;color: #1f2937;padding: 6px 12px;text-decoration: none;border-radius: 20px;font-size: 0.95em\">Back to top \u2191<\/a><\/div>\n<hr \/>\n<h2 id=\"ruleh\" style=\"background: #329EB8;color: white;padding: 12px;border-radius: 6px\">Updating Values (Rule H)<\/h2>\n<ol>\n<li>Go to Data Quality<\/li>\n<li>Run Rule H<\/li>\n<li>Click \u201cFix calcs now\u201d<\/li>\n<\/ol>\n<div style=\"background: #fff7ed;border-left: 6px solid #ea580c;padding: 12px\"><strong>&#x26a0;&#xfe0f; Important:<\/strong> Updates ALL records.<\/div>\n<div style=\"text-align: right;margin-top: 14px\"><a href=\"#top\" style=\"background: #eef6f8;color: #1f2937;padding: 6px 12px;text-decoration: none;border-radius: 20px;font-size: 0.95em\">Back to top \u2191<\/a><\/div>\n<p>div&gt;<\/p>\n<hr \/>\n<h2 id=\"mistakes\" style=\"background: #329EB8;color: white;padding: 12px;border-radius: 6px\">Common Mistakes<\/h2>\n<ul>\n<li>&#x274c; Using text instead of numeric output<\/li>\n<li>&#x274c; Not running Rule H<\/li>\n<li>&#x274c; Using checkbox incorrectly<\/li>\n<li>&#x274c; Overcomplicating formulas<\/li>\n<\/ul>\n<div style=\"text-align: right;margin-top: 14px\"><a href=\"#top\" style=\"background: #eef6f8;color: #1f2937;padding: 6px 12px;text-decoration: none;border-radius: 20px;font-size: 0.95em\">Back to top \u2191<\/a><\/div>\n<hr \/>\n<h2 id=\"best\" style=\"background: #16a34a;color: white;padding: 12px;border-radius: 6px\">Best Practices<\/h2>\n<ul>\n<li>Keep formulas simple<\/li>\n<li>Use sum() when appropriate<\/li>\n<li>Test thoroughly<\/li>\n<li>Avoid heavy use in large projects<\/li>\n<\/ul>\n<div style=\"text-align: right;margin-top: 14px\"><a href=\"#top\" style=\"background: #eef6f8;color: #1f2937;padding: 6px 12px;text-decoration: none;border-radius: 20px;font-size: 0.95em\">Back to top \u2191<\/a><\/div>\n<hr \/>\n<\/div>\n","protected":false},"excerpt":{"rendered":"<p>REDCap User AgreementREDCap FeesREDCap UsageREDCap Account RequestREDCap Login Issues REDCap Login Help for UConn Health Users UConn &amp; External Users Login Issues REDCap Guides &amp; How-toData ManagementREDCap Maintenance REDCap Maintenance REDCap Upgrade Details REDCap Training CenterREDCap SystemsCiting REDCapREDCap News You Can Use A Practical Guide to Scoring, Dates, and Dynamic Values Automatically calculate values based [&hellip;]<\/p>\n","protected":false},"author":4679,"featured_media":0,"parent":4778,"menu_order":0,"comment_status":"closed","ping_status":"closed","template":"","meta":{"_acf_changed":false,"footnotes":""},"acf":[],"publishpress_future_action":{"enabled":false,"date":"2026-05-29 07:10:40","action":"change-status","newStatus":"draft","terms":[],"taxonomy":""},"_links":{"self":[{"href":"https:\/\/health.uconn.edu\/clinical-research-center\/wp-json\/wp\/v2\/pages\/4794"}],"collection":[{"href":"https:\/\/health.uconn.edu\/clinical-research-center\/wp-json\/wp\/v2\/pages"}],"about":[{"href":"https:\/\/health.uconn.edu\/clinical-research-center\/wp-json\/wp\/v2\/types\/page"}],"author":[{"embeddable":true,"href":"https:\/\/health.uconn.edu\/clinical-research-center\/wp-json\/wp\/v2\/users\/4679"}],"replies":[{"embeddable":true,"href":"https:\/\/health.uconn.edu\/clinical-research-center\/wp-json\/wp\/v2\/comments?post=4794"}],"version-history":[{"count":5,"href":"https:\/\/health.uconn.edu\/clinical-research-center\/wp-json\/wp\/v2\/pages\/4794\/revisions"}],"predecessor-version":[{"id":4813,"href":"https:\/\/health.uconn.edu\/clinical-research-center\/wp-json\/wp\/v2\/pages\/4794\/revisions\/4813"}],"up":[{"embeddable":true,"href":"https:\/\/health.uconn.edu\/clinical-research-center\/wp-json\/wp\/v2\/pages\/4778"}],"wp:attachment":[{"href":"https:\/\/health.uconn.edu\/clinical-research-center\/wp-json\/wp\/v2\/media?parent=4794"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}