Excel’s Weird (In)Convenience: COUNTIF, AVERAGEIF, & STDEVIF

Excel is an attractive tool for those who consider themselves ‘not a math person’.  In particular, it visually organizes information and has many built-in functions that can make your life easier. You can use math if you want, but there are functions that can help even the non-math folks

If you are a moderate Excel user, then you likely already know about the AVERAGE and COUNT functions. If you’re a little but statistically inclined, then you might also know about the STDEV.S function (STDEV is deprecated). All of these functions are super easy and only have one argument. You just enter the cells (array) that you want to describe, and you’re done. Below is an example with the ‘code’ for convenience.

=COUNT(A2:A21)
=AVERAGE(A2:A21)
=STDEV.S(A2:A21)

If you do some slightly more sophisticated data analysis, then you may know about the “IF” function. It’s relatively simple; if a proposition is true (such as a cell value condition), then it returns a value. If the proposition is false, then it returns another value. You can even create nested “IF”s in which a condition being satisfied results in another tested proposition. Back when excel had more limited functions, we had to think creatively because there was a limit to the number of nested “IF” functions that were permitted in a single cell. Prior to 2007, a maximum of seven “IF” functions were permitted. Now the maximum is 64 nested “IF”s. If you’re using that many “IF”s, then you might have bigger problems than the “IF” limitations.

Another improvement that Excel introduced in 2019 was easier array arguments. In prior versions of Excel, there was some mild complication in how array functions must be entered (curly brackets: {}). But now, Excel is usually smart enough to handle the arrays without special instructions.  Subsequently, Excel has introduced functions that combine the array features with the “IF” functions to save people keystrokes and brainpower.

Looking at the example data we see that there is an identifier that marks the values as “A” or “B”. Say that you want to describe these subgroups. Historically, if you weren’t already a sophisticated user, then you’d need to sort the data and then calculate the functions for each subgroup’s array. That’s no big deal for small sets of data and two possible ID values, but it’s a more time-consuming task for many possible ID values and multiple ID categories.

The early “IF” statements allowed users to analyze certain values of the data, such as those that were greater than, less than, or equal to a particular value. But, what if you want to describe the data according to criteria in another column (such as ID)? That’s where Excel has some more sophisticated functions for convenience. However, as a general matter of user interface, it will be clear why these are somewhat… awkward.

Continue reading

The Mythology of Rice and Beans

I’ve written about proteins twice before. Once concerning protein content generally and then another concerning amino acid content of animal proteins. The reason that I stuck to animal proteins initially was because I held a common and false belief: Singular vegetarian foods aren’t complete proteins. The meat-eaters gotchya claim is that meats contain complete proteins. After all, we’ve heard a million times that beans and grains are often eaten together because they form a complete protein. The native North Americans? Corn and beans. Subcontinent Indians? Rice and Lentils or chickpeas. Japan? Rice and soy. Choose your poor or vegetarian population in the world, and they combine beans and grains. We’ve always been told that it’s because the combination constitutes a ‘complete protein’.

But you know what else constitutes a complete protein? Any of those foods all by themselves. What the heck. I haven’t been lied to. But I’ve certainly been misled. Let me briefly tell you my research journey. My recommended daily intake (RDI) are from the World Health Organization and the amino acid data is from the US Department of Agriculture. Prices are harder to pin down in a representative way, but I cite those too.  

Continue reading

The Price of a Complete [Animal] Protein

I wrote about the protein content of different foods previously. I summarized how much beef versus pea and wheat flour one would need to eat in order to consumer the recommended daily intake (RDI) of ‘complete proteins’ – foods that contain all of the essential amino acids that compose protein. These amino acids are called ‘essential’ because, unlike the conditionally essential or non-essential amino acids, your body can’t produce them from other inputs. Here, I want to expand more on complete proteins when eating on a budget.

Step 1: What We Need

To start, there are nine essential amino acids with hard to remember names for non-specialists, so I’ll just use the abbreviations (H, I, L, K, M, F, T, W, V). The presence of all nine essential amino acids is what makes a protein complete. But, having some of each protein is not the same as having enough of each protein. Here, I’ll use the World Health Organization’s (WHO) guidelines for essential amino acid RDI for a 70kg person. See the table below.

Step 2: What We Need to Eat

What foods are considered ‘complete proteins’? There are many, but I will focus on a few animal sources: Eggs, Pork Chops, Ground Beef, Chicken, & Tuna. Non-animal proteins will have to wait for another time. Below are the essential amino acid content per 100 grams expressed as a percent of the RDI for each amino acid. What does that mean? That means, for example, that eating 100 grams of egg provides 85% of the RDI for M, but only 37% of the RDI for H.

Continue reading

Lump Sum Taxes: Never by Popular Demand

The tax code is complex. That’s not news. The US federal tax code is also very progressive. Apart from that, the tax code pushes social or other policy goals. The Earned Income Tax Credit, for example, acts as a negative income tax and increases after-tax wages for those who can claim it. The idea is to incentivize earnings.

Economists tend to really like lump-sum taxes (in theory). But, despite the profession’s influence, almost nobody supports them. First, what is a lump-sum tax? It’s a tax that ignores any activities of the target. A per capita lump-sum tax would target the young, the old, the indigent, the working, the rich, the disabled… everyone. The idea is that no behaviors, aside from breathing, incur or disqualify a person from owing the tax.

Economists like them because they don’t change the relative price of labor and leisure. Whereas a marginal tax rate reduces a worker’s effective wage, a lump sum tax leaves it unaffected. People aren’t disincentivized from working/earning. Using jargon, we say that a lump-sum tax is non-distortionary.

In the simple two-good model of consumption and leisure, marginal tax rates reduce the amount of consumption that one can afford with each hour of work, making leisure relatively more attractive. Lump-sum taxes reduce the affordable amount of both leisure and consumption. Affording less leisure is the same as saying that people work more hours. It happens for two reasons. 1) Poorer people must work enough to pay the inevitable tax bill and also reach an income level of sustenance. However much work sustenance entails, it’s surely more when there is a tax. 2) Since working and earning itself is not taxed, people at all levels of income decide to work more because their after-tax wage is higher relative to the case of a marginal income tax.

At this point someone gets what I call the “French” idea. The French idea is that if we provide a lump-sum subsidy, then we can all leisure more and consume less – the opposite of a lump sum tax. What a life! We can avoid the prisoner dilemma problem where we can’t credibly commit to shirking together or actually taking a lunch. By forcing a lump-sum subsidy on everyone, we’d work a little less and do it voluntarily. We can sit outside a cafe, enjoying our coffee, baguette, and cigarette without having to worry about our neighbor with their “go get’em” attitude making us look bad.

Continue reading

More Productive than “Smart”

Public choice economists emphasize the process by which we select political leaders. Electoral and voting rules influence the type of leaders we get. Institutional economists agree and go one step further. Who we choose matters less than the environment we place them in. Leaders, regardless of their personal qualities, respond to the incentives that surround them. The ultimate policies, therefore, largely conform to those incentives. From this perspective, it’s important to adopt institutional incentives for leaders to promote policies oriented toward economic growth and provide the option to flourish.

The same principle applies to the private economy. Productivity is crucial, and higher IQ often correlates with greater productivity. Yet, genetic endowment—including IQ—is beyond individual control. Many other determinants of productivity are not exogenous when we can affect policy. Let’s adopt policies that allow individuals with lower IQ to act productively as if they had higher IQ. Protecting the freedom to contract and private property rights creates conditions whereby even those at the lower end of the cognitive ability distribution can thrive. These principles expand their opportunities. Market signals give them valuable feedback on their activities and enable them to contribute to the economy.

Continue reading

Post-Pandemic Lumber Market

Remember that one time, back when we had a global pandemic, when interest rates fell really low and everyone was borrowing and refinancing? Good times. But they were also times of surging demand for durable goods, supply chain disruptions, and shortages. Specifically, the price of lumber surged by 54% between 2019 and 2022. There were stories of contractors who were unable to do their jobs at their typical prices. Some of them went without work. Others did much less work. Theft of precious lumber was in the news.

As we know, sudden price spikes often make the front pages and the social media rounds. But they peter out and the subsequent decline in prices hardly ever gets coverage in the same way. People used to talk about higher gasoline prices all the time, but never discussed with the same enthusiasm when prices fell. The same is true for lumber. We heard hysterical stories of record high prices, alleged shortages, and the sawmills that lacked adequate capacity to keep up with demand.

What’s going on in the lumber market?

Continue reading

Protein, Protein Everywhere

If you’ve ever been vegetarian or if you have ever spoken to a vegetarian about their diet, then you have probably heard or asked “How do you get enough protein?”.  While it’s important for health and economic achievement to get adequate protein, not too long after comes the questions about types and sources of protein. This question is relevant for vegetarians and vegans, but also people with meat allergies and people with religious dietary guidelines that prohibit meat always or seasonally. Let’s break it down.

Some omnivores are incredulous that vegetarianism can provide adequate protein or protein quality. But protein itself is relatively easy to get and any judgmental attitudes on both sides are mostly just vibes. Legumes and nuts tend to have a lot of protein. But relative to what?

The World Health Organization recommends that an 80-kilogram (176 lb) adult should get 66.4 grams of protein per day (0.83g per kg). That’s the protein content of about a 9oz of peanuts. Protein is super important and it’s luckily not that hard to get if you eat a variety of foods. Even if you’re trying to consume double the WHO recommended daily intake (RDI), it’s an easy feat.

Below is a table of some popular protein sources. The table includes the grams of protein per 100 grams of food, which makes the protein content a percent. The table also includes the number of grams needed in order to achieve the WHO protein RDI of 66.4 grams. The last column is for our American readers who need the serving to be in ounces.

Continue reading

Parkinson’s Law Before Class

Parkinson’s Law, the principle that “work expands to fill the time available for its completion,” was originally intended as a satirical observation on bureaucratic inefficiencies. However, it has broader applications, especially in academic life. When preparing to teach an intermediate microeconomics class, for example, I often find that Parkinson’s Law applies: no matter how much time I dedicate, there’s always more content, illustrative examples, and analysis that could be included. The time invested in preparation creates a tradeoff between covering the broad spectrum of microeconomic theories versus delving deeply into a few core concepts. Either approach can be effective, but Parkinson’s Law reminds me that more preparation doesn’t always imply improvement.

Teaching intermediate microeconomics presents a natural tradeoff between breadth and depth. The course covers foundational concepts like consumer and producer theory, market structures, and welfare economics, and each of these areas is rich with intricate details, special cases, and real-world applications. A broader approach would expose students to more topics, providing a more comprehensive view of microeconomics. Exploring fewer topics fosters more critical thinking and analytical skills. Too much preparation on one topic can detract from time that could be spent introducing other essential concepts… Or other classes for that matter.

Let’s say I have a few hours to prepare for a Monday lecture on consumer theory. I might fall into a spiral of over-preparation: digging into endless variations of consumer surplus or finding additional applications that illustrate price elasticity. This is precisely what Parkinson’s Law warns against; if I pour time into my preparation, then the lecture becomes denser beyond the ideal for my students’ comprehension.

The extra hours may result in a more detailed presentation, but this doesn’t necessarily mean better learning outcomes. A concise, well-planned lecture is often just as effective—if not more so—than one crammed with detail. Overwhelming students with information that won’t stick is bad pedagogy.

Continue reading

Un Poco Loco, But Effective? Almost 1 Year of President Milei

I don’t like to follow politics, much less politics in another country. Policy on the other hand? I’m always hooked.

Most of us have heard of President Javier Milei by now. He became Argentina’s president in December of 2023. Prior, he had been in charge of a private pension company, a university professor who taught macroeconomics, had hosted a radio show, and has written several books. See his Wikipedia entry for more.

What makes him worth talking about is that he appears a little… unique. He’s boisterous and rattles off economic stories and principles like he wants you to get up and do something about it. To anyone in the US, he looks and behaves like a weird 3rd-party candidate – sideburns and all. He’s different. Here he is bombastically identifying which government departments he would eliminate:

I’ve enjoyed the spectacle, but haven’t paid super close attention. I know that he is libertarian in political outlook, drops references to Austrian economists and their ideas by the handful, and doesn’t mince words. Here he is talking at the Davos World Forum (English & Dubbed).

So what?

Argentina has a long history of high inflation and debt defaults. Every president always says that they’ll fix it, and then they don’t. There have been periods of lower inflation, but they don’t persist. Among Milei’s stated goals was to end that cycle and bring down inflation. His plan was to substantially reign in deficit spending by eliminating entire areas of government. We’re now approaching a year since Milei took office, and I thought that I would check in. Below is the CPI for Argentina since 2018. As soon as Milei took office prices spiked, but have started coming down more recently. Similarly, the Argentine Peso has fallen in value by 50% since he’s taken office. Ouch!

Continue reading