Tuesday, August 9, 2011

Vlookup & Image

In the spirit of being in Vegas I decided to put together a quick example of using vlookup and image.




Basically, just type the card in the yellow box or use the drop-down and you will see a picture of the card and also the total of your cards.

Here is a quick explanation of how the formula in B3 works.
=iferror(image(vlookup(B3,Lookups!$A$1:$B$13,2,FALSE),4,115,75),"Type card above")

Starting from the middle:
=...vlookup(B3,Lookups!$A$1:$B$13,2,FALSE)...
I am looking up the value in B3 which is somewhere between 2-10 or A,K,Q,J. Once that value is exactly found in my table,Lookups!$A$1:$B$13, I want to return the value in the second column of my table that corresponds with my lookup, which is a URL to the image I want. FALSE indicates that I'm looking for an exact match. If I don't find the value then the formula errors. Note: my table is on a hidden tab.

Out further:
=...image(...,4,115,75)...
This formula grabs the image from the URL specified (which I define based on my vlookup) and then I determine custom height and width. You indicate this by typing a 4 for the second parameter. For other options see the =image() function. I then defined my height and width.

The end:
=iferror(...,"Type card above"). Iferror looks to see if anything calculated within the formula has errored. If it has then "Type a card above" is returned. If not then the calculation itself is returned. The validation on the yellow boxes insures that the formula will not error (something being typed in that isn't on my list) but I added it anyway.

Sometime in the future I'll update this to make it a usable template with suggestions on what to do based on "the book". Feel free to play around with it in the template gallery!

Cheers!

No comments:

Post a Comment