Excel Comparison Formula

Here is an Excel formula that I have used on many occasions.  It solves the issue of comparing sets of data, where one sheet contains a list, and the other sheet contains an updated list, and you want to see if any data from one sheet is missing from the other.

=IF($B2="", "", (IF(ISNA(VLOOKUP($B2,'Prev Data'!$B:$B,1,FALSE)),"No","Yes")))

It breaks down like this:

The formula goes into a new column, say column C, and will display YES, or NO depending on if the value in cell B2 exists in the list in column B on sheet 'Prev Data'.

B2 contains the data that you want to compare against a list, contained on sheet 'Prev Data', in column B.

The first part, IF($B2="", "", ....) displays nothing if the cell is empty (remember, we're going to be duplicating this formula for long list, and some may be empty).

The real magic is in the VLOOKUP($B2,'Prev Data'!$B:$B,1,FALSE).  This will take the value in cell $B2, and do a lookup in column B on sheet 'Prev Data'.  The first argument, $B2, is the cell you want to lookup.  The second argument, 'Prev Data'!$B:$B, is the array of data you want to search. The thrid argument, 1, is for which column's data to return, in the data array we're comparing against.  Since it's a single column array, it's column 1.  The fourth argument, FALSE, is to tell the VLOOKUP function to return ONLY an exact match, or #NA if not match found (it set to TRUE, it will return the next closest match).

The IF(ISNA(....),"No","Yes") will check to see if the VLOOKUP returned #NA, and if so, we know we don't have a match, therefore, put "No" into the cell.  Otherwise, "Yes".



Monitor Your Database Backups using Ops Manager

And yet another article.

Granular Targeting in Operations Manager 2007

Another good post I found while on my quest to MP nirvana.

Extending System Center Operations Manager Classes & Discovery

Since I'm in the process of re-discovering Microsoft's System Center Operation's Manager, I've been trying to find more info on creating LOB application classes (actually, trying to do this dynamically - without predefining the classes - don't think I can). I came across this blog article and think it sums up the whole discovery mechanism quite well.


Korn Shell Uncertainty principle?

Below is some code that I wrote today, to test my return code, $?. I could not figure out when it failed with $?=2, why the logic in [ $? = 2 ] wasn't working.

rawSits=$(tacmd listSit -d "," -m $agentname)
echo "RC = $?"
if [ $? = 2 ]; then
echo "You must log into tacmd before executing this script"
exit 2

Turns out out I'm too dumb to notice that the act of echo'ing my $? is in itself, setting $?. Duh. Kind of like the Heisenberg Uncertainty principle; the act of observing my return code changed the outcome.

The new, working code:

rawSits=$(tacmd listSit -d "," -m $agentname)
echo "RC = $RC"
if [ $RC = 2 ]; then
echo "You must log into tacmd before executing this script"
exit 2


How The Large Hadron Collider (LHC) Works | Laughing Squid

How The Large Hadron Collider (LHC) Works | Laughing Squid

A very cool video (care of Laughing Squid) of how the new Large Hadron Collider works.


Ghost Imaging - and no, not those ghosts.

A way of capturing images using entangled-photons, thereby not requiring the capture of the actual photons that interacted, or reflected, from the object. Very cool; quantum physics rocks!