Pointy Haired Dilbert - Chandoo.org

Pointy Haired Dilbert - Chandoo.org

Excel Tips, Technology Tidbits and Business Insights

generate-bingo-tickets-in-excelI am fascinated by board games. They provide immense fun, anyone can enjoy them, they are unpredictable and best of all they are great value for money. That is why whenever I get sometime I experiment with simulating games to know them better [read Why Monopoly board game is not as random as it appears]. So, out of curiosity I have created an excel sheet that can generate bingo / housie (housey) tickets - 24 of them at a time. To get new set of tickets you would hit F9 (recalculate).

download bingo / housie / housey card maker excel sheet  Download Bingo / Housie ticket maker excel sheet

Note that these are Bingo UK / India / Australia variant I am talking about, not the US 5*5 type of bingo tickets.

Read on if you want to know how this is done:

According to Wikipedia:

A typical housie/bingo ticket .., contains fifteen numbers, arranged in nine columns by three rows. Each row contains five numbers and four blank spaces. Each column contains either one, two, or very rarely three, numbers:

* The first column contains numbers from 1 to 9,
* The second column numbers from 10 to 19,
* The third 20 to 29 and so on up until the last column, which contains numbers from 80 to 90.

I have removed number “90″ from the list in order to reduce some complexity in generating the tickets.

The problem is now to “generate 15 random number between 1 to 89 and fill them in 15 random spots in a grid of 3 rows by 9 columns such that each row has exactly 5 numbers”

Now I could write a function in VBA to do this, but I wanted to do this only using formulas. So I started breaking the problem.

The first challenge is to select any random 5 cells in a 9 cell row

Once we select any random 5 cells in a 9 cell row, we will fill them with bingo numbers. Now, excel has a function to generate random numbers between 1 to 9 (=round(rand()*9,0)), but this is not good for us since each time we call this function we will get a random number between 1 to 9, where as we need a 5 random numbers without repetition between 1 to 9. The function is memoryless and could repeat numbers when called 5 times.

Instead we can list all the possible “5 cells with numbers and others are empty” combinations of a 9 cells region and select a random combination every time. There are essentially 9C5 i.e. 126 ways in which you can select any 5 cells out of 9 cells (without repetition of course).

So I listed all these combinations in a table and then randomly selected one of the combinations. You can see the first five such combinations in the image below:

Selecting any five cells out of nine cells

Selecting any five cells out of nine cells

Now I created a 3*9 region and filled the cells with 1s or 0s, “1″ when the cell in bingo ticket is supposed to have a value and “0″ if the cell is empty as shown below:

raw-3-by-9-bingo-cell-grid-in-excel

Next challenge is to show random values in each cell

The trick here is that first column in our 3*9 bingo ticket has any number(s) from 1 to 9, second column has any number(s) from 10 to 19 …

Again, the challenge is the numbers should not repeat, otherwise we could simply use rand()*10, rand()*10+10, rand()*10+20 ... to generate the numbers.

This time it gets even more trickier because each column can have either no values, or 1 value or 2 values or 3 values.

The ticket generation logic now looks like:

  • If the column has no values in it, then we will leave all the cells in that column of bingo ticket empty
  • If the column has 1 value, we will generate any random number from that column’s range of possible values (1-9, 10-19,20-29,…80-89) and place it in the cell that is supposed to have a value and leave other cells empty.
  • If the column has 2 values, we will generate 2 random numbers without repetition from that column’s range of possible values and place them in cells that are supposed to have them
  • If the column has 3 values, we will generate 3 random numbers without repetition from that column’s range of possible values and place them in cells that are supposed to have them

As you can see, it is easy when the column has no or 1 value in it. But when the column has 2 or 3 I used the combinations trick described earlier.

First I created all 2 number combinations and 3 number combinations. Since the numbers on Bingo ticket are always sorted from top to bottom in a column, I just had to list down 45 combinations (10C2) for 2 numbers and 120 combinations (10C3) for 3 numbers.

The rest of the details are small enough that I can leave them to your imagination. So when the ticket is generated, it looks like this:

final-bingo-housey-ticket-printed-using-excel

Remember to download housie / bingo ticket generator excel sheet and print your tickets at home. Just F9 to generate new set of tickets. Un-hide the rows from 43 if you want to see how this is done.

Like this post: Consider digging it or bookmarking it on del.icio.us or better still subscribing to my feed, its yummy :D

myRoom.makeSuperCool()

In: Humor, hacks, ideas, technology

How geeky are you? Show off your geekness to others with this kickass room decor ideas,

Just click the images to follow up. live geek, love geek :D

1. Lets start with the door. You can experiment with the door locks to create your own puzzle:

puzzle-door-look

2. Now that you are in how geeky would you like to make your sofa? how about a pixel couch?

pixcel-sofa

3. Dont fancy a couch, why dont you create your own ball-pit?

fill-the-pit-with-balls

Not sure how much this would cost, you can find out using this ball-pit-pocket-hole-calulator

4. Now that you are sitting, what about those window curtains, would like them ASCII?

ascii-curtain

5. May be ASCII is a bit too old, why dont you buy a G(O)oogle saree and hang it up as a curtain?

google-saree-as-a-curtain

At 299.98, this Ooogle sari can make great (expensive ;)) curtain :)

6. what about the ceiling, isnt it too bland, why not decorate it up with old CDs & DVDs?

cd-dvd-ceiling-decor

7. Now that the ceiling is taken care, what about that dull wall paper, why not mario-fy it?

mario-wp-room

8. What about the lighting in the room, why the lame lights when you can DIY some ambient lighting?

ambient-lighting-diy

9. Now lets geekify the furniture, how about a Tetris book shelf?

tetris-bookshelf

10. Finally what is a room without something to eat, why not say hello world with slice of bread?


hello-world-bread

So what are you waiting for? Go ahead and make your room geekier than ever. Happy Friday :)

Images are not mine, hosted here. Click on them to see the original ideas and make your room geeky

Also : Make your charts super cool

Jon @ Peltiertech has taken a critical look at the partition charts suggested yesterday. You can read his review of the partition charts here. One of the commenters on his site said,

Jon, the partition chart is not that bad. It just needs to be defragmented… :)

partition-charts-in-excel-revisitedSo I de-fragmented my partition chart, this time it no longer provides any spatial trend cues or anything, instead its a cool little replacement for a pie chart, more so when you have just 3-4 pies and got bored of looking at pies.

Here is how in just 3 steps you can do this type of de-fragmented partition chart ;)

1. First create a grid where the chart can appear

defrag-partition-excel-chart-pie-alternative-fun

This is the easy step, select a range of cells (preferably in multiples of 100, I took 300 cells, spaced over 25 columns, 12 rows) and adjust the row-height and column-width till the range looks fine enough. Take a look at this one on the right.

2. Now set the Conditional Format over the range

Lets say you want to show 3 pies, one for 30%, another for 48% and the last one for 32% (well, just kidding, you can only 110% of your work, not 110% of your pies) so 22%. The conditional formatting formulas can look like this:

conditional-formatting-more-visualization-fun-defragmented-chart

Your formulas should look like this:


if cell's row-number * width + column-number is with in pie-1's range, turn the cell on to color-1
else if cell's rownumber * width + column-number is with in pie-2's range, turn the cell on to color-2
else turn the color-3 on

3. Remember to trash your pie charts

Well, not really, save the good old pies. There is no step 3. So I saved you … umm… 33% of work. So why dont you leave a comment and tell me what you think about this ?

google-iam-feeling-lucky-search-plug-in for mozilla firefox

While trying to understand how the Mozilla firefox search plug-ins work [ more ] I got curious and wrote a search plug-in that will take you to the first Google search result directly instead of displaying the results pages, ie mimicking the “I am feeling lucky” searches. Feel free to download and install it.

1. First Download the Google “I am feeling lucky” search plug-in for Firefox
2. Save the file in your Firefox searchplugins folder (usually, C:\Program Files\Mozilla Firefox\searchplugins, if not locate your Firefox installation directory and navigate to the ’searchplugins’ folder)
3. Restart Firefox, thats all, you now have a shiny little search add-in that can make you feel lucky… :)


For the curious, here is the xml file contents:

(If you are viewing this post in feedreader, you may not see the above code, in that case visit the blog to see it.)



I just took the google.xml file in the searchplugins folder and added the line

<Param name="btnI" value="I'm Feeling Lucky"/> beneath the URL tag. This will tell Google that the button “I am feeling lucky” has been clicked and hence the search engine would redirect you to the first page of results instead of the results page. Cool eh?


Click here to download the Google “I am feeling lucky” search plug-in for Firefox


how to use windows xp run dialog as search box

After seeing DI’s Open Your Favorite Websites Directly from Windows Vista Start post, I thought why not use Windows XP Run dialog box as a search box. So here is a simple trick that can enable you to open your favorite sites directly from XP’s run dialog box.

Using this trick you can type “g bbc” to directly open BBC website in firefox / IE.

First step is to create a batch file with the following text:

For Firefox users:
"C:\Program Files\Mozilla Firefox\firefox.exe" "http://www.google.com/search?btnI=I'm+Feeling+Lucky&q=%1"

For IE users:
"C:\Program Files\Internet Explorer\IEXPLORE.EXE" "http://www.google.com/search?btnI=I'm+Feeling+Lucky&q=%1"

Save the file anywhere (preferably in C:\Program Files) with a name “g.bat”. The above one line of code essentially starts Firefox or IE and requests Google to fetch your favorite site using “I am feeling lucky” feature. The “%1″ towards end tells windows to get the first parameter followed by “g” and passes it to Google.

Before you can use this you just need to modify your environment variables. For this:

1. Right click on “my computer” and select properties
2. In the dialog box go to “advanced” tab and click on “environment variables” button
using_xp_run_as_search2
3. Select “path” from system variables and click “edit” button
using_xp_run_as_search3
4. Append “;C:\Program files” (if you have saved the batch file in some other directory mention that path here) to the path in the end (dont forget the ; before C: )
using_xp_run_as_search1
5. Click OK all the way back.

Now you can use run dialog box as Google search bar with “I am feeling lucky”, You can use the same trick to do searches on ebay, amazon, imdb, yahoo or wikipedia or anything else.

Here is a ridiculously simple workaround for those of you trying to generate an organization chart in excel:

Use google org. chart widget instead :)

[If you are reading this in a feedreader this post may not display properly, visit the post page instead.]

Open a new google docs spreadsheet (or work on the example organization chart spreadsheet I have created) and enter your organization employee data in the format shown below: (enter employee name in column 1 and manager name in column 2)

Create a organization chart gadget (menu > gadget > organization chart “add to sheet”), once done, the org chart should look something like this:

Its very easy to do and saves you a lot of time. If you need some example you can access the organization chart spreadsheet I have created.

how to get more colors in excel charts, beating excel chart color limitation - how to
Here is a simple to trick to beat the 56 color limitation in excel when you are designing a chart: use picture files (jpg, gif, png etc.) to fill the chart area.

You will no longer have to worry about limiting your project report / website / annual report etc. colors to the 56 that excel has.

1 + 3 steps to get more colors in excel charts:

  1. First create a 1*1 pixel sized image of the color you want to use in excel. You can use any software like MS Paintbrush to do this, all you need is the hex code or rgb of the color you want. Visit colour lovers if you are looking for cool color ideas.
  2. Right click on any of your chart data points and select format data point
    excel tip to get more colors in a chart
  3. In the dialog select “fill effects”
    how do I get more colors in microsoft excel spreadsheet?
  4. Finally, go to “Picture” tab in fill effects and specify your picture file path.
    how to enable more than 56 colors in ms excel
    OK your changes. Thats all, now your charts have any color your want.

Also: Download 73 beautiful excel chart templates | Art of excel charting | Become a conditional formatting pro