Latest / Pharmacy Made Simple / How to Use Excel in Analytical Chemistry and in General Scientific Data Analysis
Transcript
- 0:00Speaker 1: It's essentially a giant grid, you know, a billion little
- 0:03Speaker 1: rectangles just waiting for numbers. For most of the world,
- 0:07Speaker 1: Microsoft Excel is where the boring stuff happens, balancing budgets,
- 0:11Speaker 1: organizing guest lists, maybe a quarterly report or too.
- 0:15Speaker 2: It's the digital equivalent of a beige filing cabinet, and sadly,
- 0:18Speaker 2: for a lot of scientists, it's treated the exact.
- 0:20Speaker 1: Same way, just a fancy calculator exactly.
- 0:23Speaker 2: You do your experiment, you dump the numbers in, you
- 0:25Speaker 2: make a quick bar chart, and.
- 0:26Speaker 1: You move on right. But today we are flipping that
- 0:29Speaker 1: filing cabinet upside down. We're diving into a text that
- 0:33Speaker 1: argues this grid is actually a high powered digital laboratory.
- 0:38Speaker 2: We are we're looking at Robert de Levy's comprehensive guide
- 0:41Speaker 2: how to use Excel in analytical chemistry and in general
- 0:44Speaker 2: scientific data analysis.
- 0:46Speaker 1: And this book is, yeah, it's a big deal.
- 0:48Speaker 2: It's a seminal text without exaggeration. It is basically the
- 0:51Speaker 2: bible for anyone who has ever stood in front of
- 0:53Speaker 2: a titration rig and thought there has to be a
- 0:55Speaker 2: more rigorous way to handle all this data.
- 0:58Speaker 1: And just to set the stage for you listening, especially
- 1:00Speaker 1: if you're in pharmacy school, pharmacology, or working in an
- 1:03Speaker 1: analytical lab. This isn't about you know, finding shortcuts.
- 1:07Speaker 2: No, it's about better science. The core mission here is
- 1:11Speaker 2: to move you, the learner, from doing what he calls
- 1:15Speaker 2: approximate chemistry to exact numerical chemistry.
- 1:19Speaker 1: What's the difference.
- 1:20Speaker 2: Well, in textbooks, we have to simplify the math right
- 1:23Speaker 2: to make it solvable on a whiteboard. But in Excel
- 1:25Speaker 2: we don't have to simplify anything. We can model the messy,
- 1:28Speaker 2: complex reality.
- 1:30Speaker 1: So let's get into it. We're going to cover everything
- 1:32Speaker 1: from simulating Gaussian noise to deconvoluting spectral data. Let's start
- 1:37Speaker 1: with section one, the philosophy of the tool. Delavy throws
- 1:41Speaker 1: it way.
- 1:41Speaker 2: Back, all the way back to VisiCalc, the.
- 1:43Speaker 1: Great grandfather of Excel. He points out that the name
- 1:46Speaker 1: itself was perfect visible calculation.
- 1:49Speaker 2: And that's the whole philosophy. I mean, think about it.
- 1:51Speaker 2: In a programming language like Python, the logic is all
- 1:54Speaker 2: hidden in lines of code. It's abstract. Right in a spreadsheet,
- 1:57Speaker 2: the logic is spatial, it's visual. You change unsell, say
- 2:00Speaker 2: the concentration of an acid and the graph next to
- 2:03Speaker 2: it moves instantly.
- 2:05Speaker 1: It's that immediate feedback loop. It connects the theory to
- 2:08Speaker 1: the data. But de Levy immediately pivots to the biggest
- 2:11Speaker 1: problem in that loop error.
- 2:14Speaker 2: Real world science is noisy, which brings us to the
- 2:16Speaker 2: statistical foundations. Now, usually when people think satistics in Excel,
- 2:21Speaker 2: they mean typing average. Sure, but de Levy goes straight
- 2:25Speaker 2: to generating ghostsian noise.
- 2:27Speaker 1: This part I found fascinating. He basically teaches you how
- 2:30Speaker 1: to use Excel to like break your own data on purpose.
- 2:33Speaker 2: He does. He shows you how to generate random numbers
- 2:35Speaker 2: that follow a bell curve and then add them to
- 2:38Speaker 2: your perfect theoretical model.
- 2:39Speaker 1: Okay, but why why would you want to make your
- 2:43Speaker 1: perfect data worse? That seems so counterintuitive.
- 2:46Speaker 2: It's all about stress testing. Let's say you're a pharmacologist
- 2:49Speaker 2: with a formula to calculate drug potency. If you feed
- 2:52Speaker 2: it perfect numbers, of course it works. But what about
- 2:54Speaker 2: the noisy, messy numbers you'll get from a real instrument.
- 2:57Speaker 1: Ah, So you're simulating the imperfections of reality to see
- 3:01Speaker 1: if your analysis method can actually.
- 3:02Speaker 2: Handle it precisely. And he uses this to teach a
- 3:06Speaker 2: very very harsh lesson about the triplicate.
- 3:08Speaker 1: Oh, the classic and equals three. Every student knows this.
- 3:12Speaker 1: Do the experiment three times, take the average, get your
- 3:14Speaker 1: standard deviation, and call it a day.
- 3:16Speaker 2: And de Levy shows you visually why that is so dangerous.
- 3:20Speaker 2: He sets up a simulation on one side, a tiny
- 3:24Speaker 2: data set of just three points. On the other thirty points, okay,
- 3:28Speaker 2: and when you hit retalculate to get new random noise,
- 3:32Speaker 2: the standard deviation on that small set just jumps all
- 3:35Speaker 2: over the place. It's completely unstable.
- 3:37Speaker 1: It's wildly unreliable.
- 3:39Speaker 2: It is you only see the error truly stabilized with
- 3:42Speaker 2: the larger numbers. It's a visceral lesson that you just
- 3:45Speaker 2: can't trust a standard deviation from only three data points.
- 3:48Speaker 1: That moves us to the propagation of uncertainty. I have
- 3:51Speaker 1: vivid nightmares of this from college calculus, all those partial derivatives.
- 3:55Speaker 2: Pages and pages of algebra. It's painful, and honestly, it's
- 3:58Speaker 2: easy to make a mistake. De Levy basically says, just
- 4:01Speaker 2: stop doing it that.
- 4:02Speaker 1: Way, Stop doing the calculus.
- 4:03Speaker 2: Stop deriving the huge algebraic formulas. Use the spreadsheet for
- 4:07Speaker 2: what he calls macropropagation. It's numerical, not algebraic.
- 4:11Speaker 1: Okay, walk me through that. How does that work in
- 4:13Speaker 1: the grid.
- 4:13Speaker 2: Imagine you have a calculation inputs for say volume, mass,
- 4:18Speaker 2: and temperature. You want to know how sensitive your final
- 4:22Speaker 2: result is to a tiny error in temperature. Right, you
- 4:25Speaker 2: just copy your calculation block, change the temperature input by
- 4:29Speaker 2: a tiny amount, like a fraction of a percent, and
- 4:32Speaker 2: then you just look at how much the final result changes.
- 4:35Speaker 1: So you're simulating the air instead of solving for it
- 4:37Speaker 1: with a formula exactly.
- 4:39Speaker 2: And it handles complex correlations automatically without you ever needing
- 4:42Speaker 2: to open a calculus textbook.
- 4:44Speaker 1: That's a huge time saver. But what about fitting data.
- 4:48Speaker 1: We all know the ad trend line feature.
- 4:50Speaker 2: Right click ad regression, get your R squared done.
- 4:53Speaker 1: And Olivy says that.
- 4:55Speaker 2: He says it's kid stuff because the standard trend line
- 4:58Speaker 2: assumes every single dot on your graph is equally trustworthy.
- 5:01Speaker 1: It assumes equal variance Homasi desticity.
- 5:03Speaker 2: Yes, and in the lab that's almost never true. Think
- 5:06Speaker 2: about a fluorescence essay. You might be super precise at
- 5:09Speaker 2: low concentrations, but at high concentrations the detector gets saturated.
- 5:14Speaker 2: And the noise creates huge error bars.
- 5:16Speaker 1: So the bad data points are pulling the line away
- 5:18Speaker 1: from the good ones exactly.
- 5:20Speaker 2: This is where he introduces weightedly squares. You use the
- 5:24Speaker 2: solver add in to tell Excel, hey, pay more attention
- 5:27Speaker 2: to these precise points and less to the noisy ones.
- 5:30Speaker 1: That slight shift in a calibration curve could be the
- 5:32Speaker 1: difference between a sub therapeutic ghost and a toxic one.
- 5:37Speaker 2: It's all about rigor.
- 5:38Speaker 1: Let's move to section two. Chemical equilibrium. This is bread
- 5:42Speaker 1: and butter for our pharmacy listeners. Acids, bases, pH.
- 5:46Speaker 2: The stuff that usually involves a lot of approximation.
- 5:49Speaker 1: Right textbooks always say assume x is small enough.
- 5:51Speaker 2: To ignore, because solving the full cubic or cordic equation
- 5:55Speaker 2: by hand is a complete nightmare. But Excel doesn't care
- 5:59Speaker 2: if the algebra is men So you set up the
- 6:01Speaker 2: master equation, the full, unadulterated mathematical truth of the system.
- 6:05Speaker 1: And he has this really clever trick for titrations, the
- 6:09Speaker 1: inverse approach.
- 6:10Speaker 2: Oh, this is brilliant. It completely flips the problem on
- 6:12Speaker 2: its head.
- 6:13Speaker 1: Usually we ask if I add ten miles of base,
- 6:15Speaker 1: what's the pH and.
- 6:16Speaker 2: That math is hard. It involves finding the roots of
- 6:19Speaker 2: a high order polynomial.
- 6:20Speaker 1: So what does de lev do?
- 6:22Speaker 2: He asks the opposite question to get to pH four.
- 6:25Speaker 2: How much volume of base do I need to add?
- 6:28Speaker 1: And why is that easier?
- 6:29Speaker 2: Because the equation for volume as a function of pH
- 6:33Speaker 2: is linear. It's a simple rearrangement. You just make a
- 6:35Speaker 2: column of pH values dash zero point one point two,
- 6:39Speaker 2: and the spreadsheet instantly spits out the required volume for
- 6:42Speaker 2: each one.
- 6:43Speaker 1: So you generate the entire theoretical curve in.
- 6:45Speaker 2: A second with zero iteration. And because it's so easy,
- 6:49Speaker 2: you can add complexities you normally ignore, like activity coefficients.
- 6:53Speaker 1: W Hookle theory.
- 6:54Speaker 2: Yes, in a real biological fluid like blood, you have
- 6:57Speaker 2: all these ions floating around that ionic strength changes, how
- 7:01Speaker 2: acids behave He shows you how to build a column
- 7:04Speaker 2: that automatically corrects for it.
- 7:05Speaker 1: He has that great graph of citric acid.
- 7:07Speaker 2: Yeah, the textbook curve is in black and the corrected
- 7:10Speaker 2: real world curve is in color, and the inflection points shift.
- 7:13Speaker 2: If you made a buffer based on the textbook version,
- 7:16Speaker 2: your pH would be wrong.
- 7:17Speaker 1: Speaking of complex mixtures, we have to talk about the
- 7:20Speaker 1: silage example.
- 7:21Speaker 2: Ah, the silage example. I love that we're talking about
- 7:24Speaker 2: cow food.
- 7:25Speaker 1: It's a case study from Volio in Helsinki, and it's
- 7:27Speaker 1: a perfect real world problem. Why is silage so hard
- 7:31Speaker 1: to analyze?
- 7:32Speaker 2: Well, the juice is a soup of fermentation products formic acid,
- 7:36Speaker 2: acetic acid, lactic acid, and their PK values are all
- 7:39Speaker 2: really close together.
- 7:40Speaker 1: So when you tyitrate it, you don't get those nice
- 7:42Speaker 1: distinct bumps in the curve.
- 7:44Speaker 2: No, you just get a smear, a featureless sloping line.
- 7:48Speaker 2: You can't tell what's what.
- 7:49Speaker 1: So how does Excel solve the soup solver?
- 7:52Speaker 2: This is the digital laboratory inection. You set up a
- 7:55Speaker 2: theoretical model with all the possible acids. Then you tell
- 7:58Speaker 2: solver the concentrations of these acids until my theoretical curve
- 8:02Speaker 2: perfectly overlaps my messy real world data.
- 8:05Speaker 1: It's curve fitting, but for chemical composition.
- 8:08Speaker 2: It minimizes the sum of the squared residuals. It turns
- 8:11Speaker 2: an impossible visual problem into a solvable numerical one.
- 8:14Speaker 1: Which leads right into Section three complex equilibria. This is
- 8:18Speaker 1: where we make the spreadsheet think using logic functions.
- 8:21Speaker 2: We're talking about if statements.
- 8:23Speaker 1: He uses the example of titrating halite's iodide bromide chloride
- 8:26Speaker 1: with silver.
- 8:27Speaker 2: Right a precipitation titration, and the chemistry is competitive. Silver
- 8:32Speaker 2: iodide is the least soluble, so it crashes out of
- 8:34Speaker 2: solution first.
- 8:35Speaker 1: So the governing equation literally changes mid experiment.
- 8:39Speaker 2: Exactly once the iodide is gone. The math for silver
- 8:43Speaker 2: bromide takes over.
- 8:44Speaker 1: How do you model that?
- 8:45Speaker 2: In a grid nested if statements. The cell basically asks
- 8:49Speaker 2: a series of questions. Has the solubility product for silver
- 8:52Speaker 2: iodide been exceeded? If yes, use this equation, If no,
- 8:56Speaker 2: check the next one for bromide.
- 8:58Speaker 1: It's like a decision tree inside the capulation.
- 9:00Speaker 2: It is and the result is this beautiful stepped titration
- 9:03Speaker 2: curve that perfectly mirrors what you see in the lab.
- 9:07Speaker 1: It really shows Excel can handle dynamic systems, which brings
- 9:10Speaker 1: us to Section four Instrumental.
- 9:12Speaker 2: Methods spectrometry and chromatography and the return of matrix algebra.
- 9:17Speaker 1: Matrices can be intimidating.
- 9:18Speaker 2: They get a bad rap, but de Levy argues they're
- 9:21Speaker 2: the only way to handle multi component analysis, like.
- 9:24Speaker 1: When you have a mixture of different compounds and their
- 9:26Speaker 1: spectra all overlap exactly.
- 9:28Speaker 2: You can't just look at one wavelength, you have to
- 9:30Speaker 2: look at all of them at once. He mentions that
- 9:33Speaker 2: calculating the inverse of a four by four matrix by
- 9:35Speaker 2: hand used to take an hour and a.
- 9:37Speaker 1: Quarter an hour and a quarter, and now.
- 9:39Speaker 2: It's the man verse and mut functions. You highlight a
- 9:43Speaker 2: block of cells, type the formula, hit a key combination
- 9:47Speaker 2: and boom, instant.
- 9:48Speaker 1: Deconvolution, deconvolution, unscrambling the egg.
- 9:51Speaker 2: That's a great way to put it. You're taking a
- 9:54Speaker 2: messy combined spectrum and mathematically separating it back into its
- 9:58Speaker 2: pure components.
- 10:00Speaker 1: And what about chromatography. How do you simulate a whole column?
- 10:03Speaker 2: He uses plate theory. Imagine slicing the column into thousands
- 10:08Speaker 2: of tiny sections or theoretical plates like a over bread exactly.
- 10:12Speaker 2: Then he uses the binomial distribution to model the probability
- 10:15Speaker 2: of a molecule moving from one slice to the next.
- 10:18Speaker 1: So you can literally watch the peak travel down the
- 10:21Speaker 1: rows of the spreadsheet.
- 10:22Speaker 2: You can watch it travel and spread out. You see
- 10:24Speaker 2: the band broadening in real time. It's a fantastic way
- 10:27Speaker 2: to understand the Van Deemter equation and find the optimal
- 10:30Speaker 2: flow rate the sweet spot for your instrument.
- 10:33Speaker 1: Okay, that brings us to the final most advanced section.
- 10:36Speaker 1: We're in the deep end now.
- 10:38Speaker 2: Four Yer transformations FFT.
- 10:41Speaker 1: This sounds more like signal processing than chemistry, but.
- 10:44Speaker 2: Modern chemistry is signal processing nmr IR. They all capture
- 10:50Speaker 2: data in the time domain and have to flip it
- 10:52Speaker 2: to the frequency domain to make any sense of it,
- 10:55Speaker 2: and Excel could do that. It's in the analysis toolpack.
- 10:58Speaker 2: De lev shows how you can use it to understand noise.
- 11:01Speaker 2: Noise is usually a high frequency signal, so you transform
- 11:04Speaker 2: your data, chop off the high frequencies and transform it back.
- 11:07Speaker 1: You've just filtered your signal and you.
- 11:09Speaker 2: Did yourself, so you understand what happened. You didn't just
- 11:11Speaker 2: push a button on a black box.
- 11:13Speaker 1: And finally, kinetics reaction rates.
- 11:16Speaker 2: Super important for drug shelf life or metabolism. He contrasts
- 11:20Speaker 2: two simulation methods, explicit and implicit.
- 11:23Speaker 1: Give me the simple version, okay.
- 11:25Speaker 2: The explicit or oiler method is like walking in the dark.
- 11:28Speaker 2: You look at your compass, close your eyes and take
- 11:30Speaker 2: a big step in that direction. If the path is straight,
- 11:33Speaker 2: you're fine. But if the path curves while your eyes
- 11:36Speaker 2: are closed, if the reaction rate changes fast, you step
- 11:39Speaker 2: off the trail and accumulate.
- 11:41Speaker 1: Error and the implicit method that's.
- 11:43Speaker 2: Where you take the step. But before you fully commit,
- 11:45Speaker 2: you check the compass at your new location to make
- 11:48Speaker 2: sure it agrees with how you got there. It requires
- 11:51Speaker 2: iteration using goal seek, but it's much more stable for
- 11:54Speaker 2: fast reactions.
- 11:55Speaker 1: So stepping back, we've gone from VisiCalc to fouryer transform. Yeah,
- 12:00Speaker 1: what is the single biggest takeaway from all of this.
- 12:03Speaker 2: It's about agency. De Levy wants you to stop treating
- 12:06Speaker 2: your software like a magic box.
- 12:08Speaker 1: The black box syndrome.
- 12:09Speaker 2: Right, you put samples in, numbers come out. If you
- 12:12Speaker 2: don't understand how those numbers are derived, how the noise
- 12:15Speaker 2: was filtered, how the curve was fitted, you aren't really
- 12:18Speaker 2: doing science. You're just operating a machine.
- 12:21Speaker 1: Building the model in Excel forces you to understand the
- 12:24Speaker 1: underlying logic and the math exactly.
- 12:26Speaker 2: You own it. You can tweak it, you can stress
- 12:28Speaker 2: test it. It empowers you to be a better, more
- 12:31Speaker 2: thoughtful analyst.
- 12:32Speaker 1: I love that. Now, before we wrap up, we have
- 12:34Speaker 1: a challenge for you. Listening a little review exercise.
- 12:37Speaker 2: Put your lab coat on. Imagine you're back at the bench.
- 12:40Speaker 2: You've got a mixture of three different acids. Their pKa
- 12:44Speaker 2: values are all overlapping, just like that silage juice. You've
- 12:47Speaker 2: run one experimental titration.
- 12:50Speaker 1: Here's the question, how specifically would you use the solver
- 12:54Speaker 1: function to figure out the concentrations of those three ascids?
- 12:58Speaker 2: And don't just say i'd use so think about the mechanism.
- 13:02Speaker 2: What specific value are you asking solver to minimize. What's
- 13:06Speaker 2: the relationship between your real data and your theoretical model
- 13:10Speaker 2: in that calculation.
- 13:11Speaker 1: If you can visualize that grid in your head and
- 13:13Speaker 1: answer that, then you've really grasped the core of this book.
- 13:16Speaker 2: It's the difference between guessing and truly solving.
- 13:19Speaker 1: Robert to Levy's work is a powerful reminder that the
- 13:22Speaker 1: most important tool in your lab might just be the
- 13:24Speaker 1: one already installed on your laptop.
- 13:26Speaker 2: Thanks for diving in with us, Happy calculating,