Nutrition is not the main subject of this post. There are other basic requirements in my project that make the use of a database solution extremely inconvenient.
As a reminder, the main topic is the observation that the sort selected from the menu breaks the relationships established by named cells.
When someone wants to sort named cells referenced anywhere in the document, calc should at least display a warning, or the sorting should update references.
Thanks, @Villeroy, for showing that other brands’ spreadsheets work the same way.
Every professional application uses some type of database for any task similar to this one. The clou is that you never have to modify anything once the data storage is finished. A database like the one I’ve uploaded can be used for many years without modifications. Once it has reached a level feature completeness where you don’t add more tables and columns, all you have to do is appending more data and run reports. A spreadsheet is a constant maintainance hell and source of wrong information, no matter how many sophisticated formulas or macro code you throw at it. In 30 years, I have seen very few databases on sheets actually working as a long term data collectors. They all involved massive amounts of VBA code on top of MS Excel for a solution that could be easily plugged together with the most basic features of the MS Access database.