There are several ways to do this. As follows could be one way:
Foundation:
Thing will be called an “Ingredient” and will have 2 fields for explanation purposes: Name (text), and Grams (number)
Repeating groups will be called RG1 and RG2. Both will have content type “ingredient” and their data sources will be “search for ingredients”. In your real app, use search constraints as needed for each RG search.
Create two custom states on the page that the RGs are in, which will be called “grams1” and “grams2”. Both with type “number”.
Summary
User clicks on their preferred row of RG1 which loads the grams value to grams1 (the first custom state). Then does the same for RG2 which loads this second grams value to grams2
Logic
When a row from RG1 or RG2 is clicked load the row’s ingredient to the page custom state respectively. This is done thorugh the action “set custom state”. Example: Event: when a user clicks this RG row, Action: set current cell’s ingredient grams value to page grams1
Write the corresponding expressions in the why answers (2.53x more proteins … etc etc). Example: “page grams1 value / page grams2 value” more proteins per 100g
Optional: Condition the why question (why is chickpead better than tofu…) to show comparisons only if the custom states are not empty
I know that the explanation is not super specific. Hope this makes some sense anyways and provides you guys with basic guidance to get you going.