top of page

Xlegant Showcase: USDA vs. KETO Nutrition Tracker


Remember the food pyramid? It's now a circle called MyPlate, but the pyramid ingrained a generation of Americans with the idea that good nutrition is based on lots of grains, fruits and vegetables, with limited meats and especially low in fat. But why then has obesity grown and overall health declined? One alternative view to a proper human diet flips the pyramid upside down, with dramatic results. Today's Xlegant Showcase aims to expose these two opposing pyramids with our signature user-friendly and aesthetic design.


Read to the bottom for a special offer.

Purpose

I've always enjoyed good health, but many years ago I was told that my cholesterol was out of safe range. My doctor prescribed a statin to lower it, which I took for some years, until I realized that my muscle pain was a statin side effect. My doctor then prescribed a different, lower-dose statin. I took that for a while but was beginning to suspect that there was a lot more to the story than just "statin good, cholesterol bad," and I started to do my own research.


These days it is easy to fall into a "I've done the research" trap after watching a few videos on YouTube. It should not be the end, but it's not a bad beginning of an investigation. A key catalyst of the scientific process is to find conflicting viewpoints. It can be discomforting but requires us to question and reason. Then we can follow references and studies to learn more and arrive at an informed opinion.


Starting from "cholesterol," my research led me in many directions. So it was that I gained what I'll call a decent layman's understanding of how lipids work in the body, what are the true cardiovascular risk factors and their root causes, and the dark side of statins. What struck me most was the general idea that there is a proper human diet, and that if we can find and follow it, our health outcomes will be optimized without medication.


But isn't the government responsible to determine and tell us what we should eat? Here was an important and refreshing reminder of how to do science. We must be willing to challenge even the most widely accepted assumptions, even our own personal beliefs, in order to discover truth through a chain of evidence.


I learned the concepts and rationale of low-carb diets that flip the nutrient guidelines on their head, from LCHF (low carb high fat) to ketogenic to carnivore. I decided that my best shot at taking control was to experiment on myself. I didn't start out as keto, but simply limited carbs to see what happened. I completely stopped eating bread, cereal, milk, pasta, and most potatoes and rice. I wasn't trying to lose weight, but within a month I had lost 20 pounds, reaching a very stable weight that feels just right for me. I had more energy, better sleep and mental alertness.


Besides the biological science supported by personal experience, the facet of this study that struck me the most was the status of information. The establishment view that we should eat mostly carbs and little fat dominates, supported by the food, medical and pharmaceutical industries. The process to arrive at those standards is very opaque. By contrast, the alternative, low-carb community is grass-roots, less visible, but more transparent in explaining the science. In recent years advocacy groups have been formed to influence public policy, such as TNC and L-CAN, see references below.


References (partial list)

US Government (USDA, Department of Agriculture)

Medical Professionals and Groups

Public Policy Advocacy

Ketogenic Diet

Foods and Nutrients

In the US, the USDA (US Dept. of Agriculture) and HHS (Dept. of Health and Human Services) collaborate to produce the DGA (Dietary Guidelines for Americans) every five years. The FDA (Food and Drug Administration) regulates and enforces accurate food labeling based on the DGA.


The government is happy to tell you what to eat via myplate.gov. On the other side there are many websites offering keto guidance and recipes, such as ruled.me and ketofocus.com. If you want to decide for yourself what to eat, it can be challenging to find both the proper nutrient consumption levels and the nutrient composition of foods.


Food labels are important to read, but to control your diet you can't rely on them alone. Calorie requirement, portion size and daily values are generic. If you know your targets, the labels give you nutrient grams per serving, but that's still based on what's often an unrealistic serving size. Further, the best foods are unlabeled, single-ingredient foods that require another source for nutrient information. Thankfully, Excel has one built-in.


The data source is the Wolfram Data Type for Foods (Data > Data Types) available to Microsoft 365 subscribers for a limited time (ends June 11, 2023). This data type connects a food description that you type into a cell with the nutrient content information.


Dietary Reference Intakes (DRI)

So, Excel will give us food content, but how do we know how much of what foods to eat? After considerable searching I found a calculator for USDA target values, billed as "DRI Calculator for Healthcare Professionals." This raised two questions, first, why just for professionals, and second, why has no professional ever mentioned my DRIs, let alone offered to calculate and explain them to me? Apparently, no one knew I was a meticulous Excel geek who would use them to monitor and control my own diet, but I suspect the reality is that DRIs are far from the mind of healthcare professionals.


Keto targets are not that easy to find either. There are carb levels cited, most commonly 20 g net carbs, with emphasis on high fat intake. I found a calculator on ruled.me. Compared to USDA, it has more inputs, making it more personal, and fewer outputs, making it simpler to follow. Both calculators give calories needed, and the three key macronutrients, fat, carb and protein. The tool will focus on these three.


DISCLAIMER: This describes my personal journey and in no way suggests that it applies to you, or that you should go keto, avoid statins, etc. If you are on or are considering a similar path, I think you'll find this quite helpful. If not, you may find it interesting and informative anyway, and I hope it will at least make you think about why you eat the way you do.


Incidentally, after completing this application, I found a Microsoft template called Nutrition Tracker. If you care to check it out and compare it to mine, you will surely find it lacking in several ways. If that happens or if you just appreciate my work, please consider giving me a like and a share.


Tool Overview

The aim of the tool is to compare and contrast the USDA and KETO dietary approaches, in a format to enable planning and tracking of a balanced diet. It could be used for any two diets, or for one alone. USDA and KETO provide a striking and illustrative contrast.


The tool is table-based, with each table on a separate sheet. There are two source tables for Targets and Foods, which are for initial setup and rare maintenance. There is one data entry table to input Meals eaten or planned. Tracking is done on a Dashboard sheet using array formulas to summarize, filter and chart the Meals data.


Formatting Standards

I try to pick formats that are intuitive and aesthetic. I always use white for user entry cells only. This can be "no fill" or white fill; white fill works well in tables to copy the format to new rows. Light shades are used for sheet background, formula cells, sheet headings, etc., while table headings are dark blue with white font. Table headings have help text popups. Summary:




Targets Sheet / Table

The Targets table lists the nutrients that are required by the FDA to be listed on food labels. In theory, any nutrient with a daily value defined can be tracked, but I limit tracking to the main headings, fat, carbs, fiber and protein, for which I can also get keto targets. Keto carb targets are given in net carbs, which is total carbs minus fiber.


USDA updates DV (daily value) guidelines every five years. The generic 2000-calorie DV's for 2020-2025 is given and compared to the previous 2015-2020 version. This shows that, according to this authority, we should slightly shift calories from carbs (-25g) to fat (+13g), but the carb DV is still about 10x the keto number.


Cells shaded green refer to values derived from online calculators, one for USDA and one for Keto. These take biometric inputs and return personalized target consumption amounts. Additional columns allow for +/- ranges to be defined.


Foods Sheet / Table

This is a lookup table of the Foods data type. There's no special trick to using data types. Type any food name, e.g. "cucumber" in a cell, then select Data > Data Types > Foods. An apple icon appears in the cell, which opens a "card" of nutrition info, and an "Insert Data" button floats above the cell, giving you a list of all the fields you can add. If you want to list and reference many foods, it is best to set it up as a table. Then, each additional field you select is added as a table column. Table formulas are in the format

=[@Food].[related field] for example, =[@Food].[fat, total].


The Foods table feeds the Meals entry form, so it should be a list of whatever foods you commonly or occasionally eat or might want to eat. When the Wolfram service goes away in June 2023, the foods in the table will remain but no more can be added. Therefore, add whatever you can think of before then. The Meals table is set to disallow foods that are not in this list.


The nutrient columns are helpful for sorting and browsing the table. They are also used to sort the picklist in the Meals table, based on sort selections on the Meals sheet. There are two hidden columns off to the right of the table, which store internal lists. They are hidden by grouping the columns, then hiding the group buttons (Ctrl+8). A small "?" cell gives tips on how to reveal/hide the columns.


The first hidden column is a list of the fields by which foods can be sorted. This is a named array, i.e. foodfields =Foods!$O$7#. This name feeds the pick list of "sort by" fields on the Meals sheet. Tech note: Data Validation does not accept array functions or array constant names but does accept sheet array names. This makes it worth the trouble to store lists as arrays in hidden columns and give them alias names.


While the first hidden column feeds the listsortby selection, the second hidden column is the result of the listsortby selection. That selection is "XMATCH"-ed against the foodfields list to CHOOSE the field to SORTBY. The list is named, foodlist =Foods!$P$7#, which supplies the picklist to the entire Meals[food] column. Here, listsortby and listorder are the selection cells on the Meals sheet, each with their own validation rule and picklist.


Related Foods

The database has many foods, but sometimes an entry is not recognized. If this happens it might give you some close options, or you may have to try different spelling. You can also view an existing food's "related foods." To view related foods, open the food's card and scroll to the bottom. Open the Categorization folder and select related foods. You might be surprised at how many there are. Some have brand names, and some have identical spelling. The data are not perfect but reasonable.


Meals Sheet / Table

The Meals table is the main data entry form. Here you enter the [date], [meal] and [food] eaten. Two special columns are [ref] for reference meal and [amount].


Meals[food]

As described above, the [food] column is fed and restricted by the foodlist defined on the Foods sheet. By selecting listsortby and listorder you refine the form. Thus, you can sort foods alphabetically, or by lowest carb content, highest fat, etc. for convenience not only when entering foods you ate but in finding foods to eat next to meet your goals.



Meals[ref]: Reference Meal

Reference meal identifier [ref] allows you to repeat a meal with a single entry. This involves two steps:

  1. Define the reference meal: the first time you eat it, list all the foods eaten and assign each the same [ref] number.

  2. Apply the reference meal: the next time you eat the same meal, simply enter date, meal and [ref] number. Nutrient values are summed.


Meals[amount]

The Wolfram data model allows entry of an amount within the same cell as the food, for example, "8 oz apple cider," and the nutrient data are scaled accordingly, as long as the unit is recognized. This is a convenience for one-off lookups, but not good for a regular-use app. Better to keep foods and amounts separate, then scale the standard values up or down.


The common serving description [common] gives the reference amount in a common unit, converted to grams in parentheses. The input column [amount] then allows for scaling the common serving to adjust the amount eaten. This is done either as a multiplication, if a number only is entered, or as a unit conversion.


Unit conversion requires a valid unit, i.e. one recognized by the CONVERT function. For example, here we're converting to grams, which is a mass unit; to enter ounces, use "ozm." CONVERT considers "oz" a volume unit. If you're not familiar with CONVERT, experiment with it to learn, or check out my Converter Tool.


The [amount] entered is thus transformed to [multiplier]. If no amount is entered, [multiplier] is 1. Thus, when entering foods, first look at [common] to see if the common amount is close to the amount consumed; if so, leave [amount] blank.


Meals[multiplier]

The [multiplier] column is a complex formula that performs both transformation and error handling tasks. The AFE Grid tab is very helpful for writing and showing the formula, and I retract my earlier dismissal of it.


Here's a list of objectives for this formula:

  1. extract value and unit from [amount]

  2. extract value and unit from [common]

  3. convert or pass [amount] value as multiplier

  4. flag [amount] unit errors

  5. flag [ref] errors


Errors are flagged within the table, with additional help text in the header above it.


Meals[fat], etc.: Nutrient columns

Each nutrient column must accomplish two tasks. The first is simple: when a food is entered, multiply the reference nutrient value by the multiplier. The second is a bit more complex: when a reference meal is applied, return the sum from the same column of the rows which define that reference meal. As a column function referencing itself this is technically a recursive function, but it works because the criteria given SUMIFS prevent any cell from transforming itself.


Dashboard Sheet

The Dashboard presents side-by-side table and chart. This table is not "formatted as table," because it uses array functions which are incompatible with structured tables. It has three selections which are placed above the table:

  1. Two radio buttons select the source of the targets, USDA or KETO. This also sets whether carbs are counted as net or total. Linked cell: source

  2. An entry cell sets the timeframe of the data in backward days. Cell name: period

  3. A checkbox sets whether future dates are included or not. Future dates allow you to set and track a meal plan versus a diary. Linked cell: future


Targets

Targets (green cells) are retrieved from the Targets table via XLOOKUP based on the selected source. High and low values add the +/- % tolerances.


Date

The date column array responds to the time selections and determines the rows for all other columns.


With Meals[date] filtered, each other column is them some variation of

=SUMIF(Meals[date],$B7#,Meals[calories]).

The exception is carb, which both header and data respond to source to select carb (USDA) or net carb (KETO).


Chart: Horizontal High/Low Lines

It's often helpful to put static horizontal target or threshold lines on a chart as context for the variable data. This can be done with a column that has the same number of data rows filled with the same value. However, such a column is an uninteresting distraction and should not be shown. The question is how to hide it.


In my book I've discussed various ways of hiding data, and reasons for doing so. One favorite way is to hide columns by grouping them, making them easy to unhide when needed. That won't work here because the chart won't show hidden columns. Another simple way to hide the data is by custom number format, ";;;". Semicolons separate the four types of custom formats: positives; negatives; zero; text. Thus, each semicolon with no format code suppresses the display of the relevant data. Three semicolons hides everything. The high/low lines for fat, protein and carbs thus appear on the chart without cluttering up the table. The values come from the table header and can be viewed there.


The ability to toggle USDA vs. KETO targets on the chart clearly illustrates how opposed these approaches are.


Chart: Vertical "Today" Bar

Since the date range of the chart can include both past and future, it will also help to show a vertical bar for today. This is similar to the horizontal lines, but in this case, we want all rows to be zero except one; that one corresponding to today, having the value of the maximum of the other data series, so that the bar height will cover the chart data height. This is similarly hidden by format and displayed on the chart on the secondary axis. The two vertical axes are identical, but this allows the today column to overlap the data columns. The today bar is formatted gray with 50% transparency.



Conclusions

Comparison of the two very different diet regimens is educational and is due exposure. The tool gives reference to online sources and calculators so that each individual can easily customize the targets.


The Foods Data Type, while available, is a reasonable source for food facts, but it's a bit clumsy to find the specific foods of your meals. I will watch for what other data sources become available to replace Wolfram.


The Meals entry form offers the convenient features of the custom-sorted food picklist, the reference meal, and the amount multiplier.


The Dashboard offers selections of source and time frame for the tracking chart.


The user-friendly features of the tool are simple enough to understand and use and offer superior functionality.


Personal Conclusion

From my experience, I eat until I'm full, and I almost never feel hungry or tired, but the resulting nutrient levels seem low, particularly fat and protein. This might be due to ambiguous food selections, or hidden foods such as snacks (nah), sauces, etc. I don't intend to keep the meal diary going for long, but it's already helped a lot to show me where I can make some changes. I will also use it on occasion to evaluate recipes and restaurant menus, and maybe I will track a week or so every month or quarter, as a checkup.


Special Offer

The file is for sale in the store, free until Jan 13, 2023 with coupon getitnow.


5 views0 comments

Recent Posts

See All

Comments


bottom of page