=SUMPRODUCT

I knew what I wanted: a way to define a “weight” column that would tell me how many times a particular pair of values appeared in my spreadsheet. I spent some time (a lot of it) searching the web using various sentences about frequency and counting. I read a lot of documentation for =FREQUENCY (which isn’t quite what I need) and =COUNTIF (which works for one column, but not for two). At some point I realized I was looking for =SUMPRODUCT. So here’s a secret: I don’t understand how or why SUMPRODUCT works. I kind of do know that you can use it for a test like this, but I was really struggling to wrap my head around why it is the right tool.

I get it now, though. What clicked for me was xldynamic’s explanation of the arrays that a SUMPRODUCT formula creates when you include comparisons.

And I want to know how many rows have the exact same values in columns D and E:

=SUMPRODUCT(($D$2:$D$224=D2)*($E$2:$E$224=E2))

Worth knowing: a boolean result can be represented as TRUE/FALSE, YES/NO or 1/0. I don’t know why that is, by which I mean, it makes sense to me intuitively but I can’t actually explain it to you. So perhaps we’ll explore that in the Ladygrammar Book Computing Club. For now, just trust me. We’re going to represent TRUE as 1 and FALSE as 0.

So. If I were dealing with a table like this:

Value A Value B
0 25
0 25
0 35
0 37
0 42
0 0
1 11
1.5 3
1.5 9
1.5 9
1.5 25
2 2
2 7

I’d use a =SUMPRODUCT formula to create two arrays about each row, and add up the product of each array. So the first instance of the formula would first compare my first Col A value (“0”) to every other value in Col A and create an array of the results (which are TRUE, TRUE, TRUE, TRUE, TRUE, TRUE, FALSE, FALSE, FALSE, FALSE, FALSE, FALSE, FALSE). Then it would compare my first Col B value (“25”) to every other value in Column B and create an array of those results. Then it iterate through those two arrays and create a third array which contains the product of each pair of values. TRUE * TRUE is 1, FALSE * TRUE is 0, FALSE * FALSE is 0.

TRUE TRUE 1 * 1 = 1
TRUE TRUE 1 * 1 = 1
TRUE FALSE 1 * 0 = 0
TRUE FALSE 1 * 0 = 0
TRUE FALSE 1 * 0 = 0
TRUE FALSE 1 * 0 = 0
FALSE FALSE 0 * 0 = 0
FALSE FALSE 0 * 0 = 0
FALSE FALSE 0 * 0 = 0
FALSE FALSE 0 * 0 = 0
FALSE TRUE 0 * 1 = 0
FALSE FALSE 0 * 0 = 0
FALSE FALSE 0 * 0 = 0

Then it adds up the SUM of all those PRODUCTS. Get it? SUMPRODUCT.

1 + 1 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 = 2

There are exactly two rows where Col A is 0 and Col B is 25. I repeat that formula for each row, et voila:

Value A Value B =SUMPRODUCT
0 25 2
0 25 2
0 35 1
0 37 1
0 42 1
0 0 1
1 11 1
1.5 3 1
1.5 9 2
1.5 9 2
1.5 25 1
2 2 1
2 7 1

Then, hypothetically, I could use that third column to calculate the radius of points on a scatterplot. Also handy? Libre Office Calc’s save as HTML option.

PS. If you’re clever, you’ll notice that the scatterplot doesn’t really show any kind of correlation. That’s okay — my project was just to figure out how to make it in D3.

Asparagus Quiche

Had a gin and basil cocktail the other night. I believe “aspirational” was the word kthread chose.

Eventually, there will be asparagus. In California, there’s been asparagus for a month already.

8 oz. Asparagus, washed, trimmed and cut into 1 1⁄2 inch lengths
4 lg eggs
1/4 cup milk (or whipping cream, if you’re decadent like that.)
1 tsp Dijon mustard
1/8 tsp salt
1/8 tsp cayenne pepper (or more, if desired)
1/4 tsp paprika
1 cup small-curd cottage cheese
1 cup grated Gruyère cheese
1/4 cup grated Parmesan or Romano cheese

Preheat oven to 350°F. Butter a 9 inch pie plate.

Using a small sauté pan with a cover, heat about 1⁄2 cup water just to boiling. Pour in sliced asparagus, cover, and turn off heat. Allow asparagus to steam w/ heat off while
you prepare the other ingredients.

In a large bowl, beat eggs on medium speed until they are very well blended. Blend in the milk, mustard, salt, pepper, and paprika until well combined.

Using a heavy wooden spoon, stir in the cheeses, stirring until well combined. Drain asparagus (should still be bright green, tender but slightly crunchy). Put it into the bottom of the pie pan. Pour the egg mixture over the asparagus and place quiche into oven.

Bake for 30 – 40 minute, or until quiche has puffed and browned, and is set in center. Allow to cool 5 minutes before slicing.

Good Real Food

I’m slowly retrieving my posts from Good Real Food, as much for my own reference as anything. There are a few more that might just sit there:

Bay Leaves from Montenegro

Greek Butter Cookies with Sambuca (actually, that’s pretty much it. If it is winter, eat cookies Cookies while sipping Sambuca.)

And there’s one called Shrimp Curry, from the nutritional mythology files, which goes like this:

I have a few recipes that I saved from my grandmother’s recipe box, most because they struck me somehow and not because I remember her making these things. One is for shrimp curry. It isn’t much bigger than a postage stamp and has floated around my kitchens for the last decade. I realized, as I was reading it over this weekend, that I’ve never actually read this recipe before or I would have been floored by it already.

To make Shrimp Curry one blends 1/2 tsp curry powder into 1 cup of mayonnaise and gradually adds 2/3 cup evaporated milk. Got that? Curry powder, mayo, canned milk. Okay, still with me? You blend these things and add 1 1/2 cups cooked shrimp, 2 T each of chopped pimiento and bell pepper and 1 T chopped onion. Heat these things and serve them over rice.

Next time someone starts rambling about how our grandmothers cooked balanced meals in some long lost once-upon-a-time, do me a favor and set them straight. Some did, some didn’t.

Dinner This Week (for Kiffy)

And for me. Somewhere around this point every winter I’m at a total loss for meals. To answer Kiersten’s question (what do you eat for dinner?) and my own (what on earth do we eat now), this time … I’ve roasted a squash and cooked a lot of garbanzo beans. I made some lime and sesame oil dressing and some tahini sauce.

Sunday, squash / miso / mugwort udon / scallion / hard boiled egg (loosely based on a recipe); carrot and chickpea salad with lime/sesame dressing. We got some turkey sausage at the farmers market, so we have to use that soon, too. Monday, Possibly sausage spaghetti, or else butternut squash and garbanzo beans with tahini sauce. Tuesday, leftover mujaddara (caramelized onions, lentils, short grain brown rice) with yogurt. Wednesday, see Monday. Continue reading “Dinner This Week (for Kiffy)”

Bulgarian Pepper Casserole (GRF 9/2010)

Originally posted September 2010; Retrieved from the Way Back Machine

I cannot, for the life of me, imagine walking into a restaurant and selecting “Bulgarian Pepper Casserole” off the menu. I can’t. But Jan made it for the farm trip potluck and it was excellent. And then last week we got of an airplane in Atlanta, into a car, onto a highway. Three hours later we were slowly coming to terms with the fact that it was Sunday and we were tired and would need to make dinner out of groceries we hadn’t bought yet, starting from an empty pantry and for that we’d need a plan. So I pulled up the recipe. We couldn’t find feta or anything approaching greek olives at the Ducktown Piggly Wiggly, so I bought some jack cheese. I was really tired, so we only bought one onion and one green pepper. When we got to the cabin and there was absolutely no reception and my phone browser didn’t have the page cached, so I had to work from memory. We’d found a woman who sold brown eggs from her garage ($1.75/dozen, leave the money in the basket, take the eggs from the fridge), so we had some eggs and it made sense to me to add an egg to the ricotta, so I did. It came out pretty good. I bet with a recipe at hand it’d turn out even better.

Which brings me to this: I want to make more casseroles this fall. Just because. I don’t know why really. Before we left, Rachel and I assembled a sort of modified enchilada that got me thinking casserole. Onions cooked with roasted peppers (Zach and Rachel have a flame thrower, always fun to use) and a can of beans. Tortillas, softened a bit, wrapped around some cheese and drizzled with mole and some bean juice. Hippie food, but it came out good, especially for a meal that started with “Well, we have a can of beans somewhere, I think.”

Kombucha

When I started brewing kombucha, I had a hard time distilling the instructions (which are everywhere) into the nuts and bolts. Here’s the thing no one just spells out: for every 3 quarts of tea, use about 1 cup of sugar. The rest of it goes like this:

You need a container. Glass is best, metal and plastic are no good. Some people use ceramic, which is fine, though I like a transparent container so I can keep my brew on a high shelf and check on it from time to time. So I have a giant pickle jar.

For best results, you want the surface area to be wider than it is deep, but it doesn’t matter that much. My pickle jar is much deeper than it is wide, but I don’t usually fill it.

You need tea, green or black or oolong.

You need sugar, white or brown. No honey. 1 cup of sugar per 3 qts tea.

And you need a starter, aka a mother or a scoby.

It helps to have some brew from your last batch.

You need a piece of cloth. I used cheesecloth for a long time until a fruit fly epidemic in our compost made it’s way to the cupboard where my kombucha was brewing. That was truly revolting. Now I use a clean piece of sheeting, which has a much tighter weave than cheesecloth.

Continue reading “Kombucha”

Crack, By Popular Request

A salad dressing you don’t think will be good, because nutritional yeast is for hippies, but you are wrong.

These go in a blender: ⅓ c tamari soy sauce, ⅓ c cider vinegar, ½ c water, 2-3 cloves of garlic,  ½ c nutritional yeast.

Blend them. Then add 1½ c vegetable oil. The recipe makes a big stink about adding it very slowly, which does make some subtle difference in the consistence, but I don’t bother. Put it in a jar, but the jar in the fridge. Or put it on a salad. Or you know … a little of each. You might be tempted to use olive oil, because it is good for your heart or something. Don’t. Use canola oil. On the other hand, I’m pretty sure that substituting shoyu for tamari won’t actually ruin the crack-like addictive quality of the dressing.

From Hollyhock Cooks

 

Mapping (to read)

Skipped out on Hacks and Hackers tonight in favor of my quiet couch. The twitters say these are worth looking at:

https://github.com/albertsun/gmap-features

http://projects.propublica.org/redistricting-maps/protect-your-vote

http://censusmapmaker.com/

Next item: I need to understand analytics much more deeply again.