Archive for the ‘Excel’ Category


Reverse geocoding is the process of taking a set of GPS coordinates and turning it into the nearest available address.
Browsing through the net, I found VBA code on many websites to get GPS coordinates(latitude & longitude) from a location address but found it really hard to get a reverse geocoding in VBA.
It can be achieved using following Google API:
http://maps.googleapis.com/maps/api/geocode/json?latlng=-33.856098662,150.996315097333&sensor=false

It will return JSON, that can be parsed to get the nearest available location.
e.g.


Function GEOAddress(dblLatitude As Double, dblLongitude) As String
         
    Dim strJSON         As String
    Dim strAddress      As String
    Dim lngTemp         As Long
    Dim objXml          As Object
    Dim strUrl          As String
        
    strUrl = "http://maps.googleapis.com/maps/api/geocode/json?latlng=" & dblLatitude & "," & dblLongitude & "&sensor=false"
    Set objXml = CreateObject("Microsoft.XMLHTTP")
    With objXml
        .Open "GET", strUrl, False
        .send
        strJSON = .responseText
    End With
    Set objXml = Nothing
        
    lngTemp = InStr(1, strJSON, "formatted_address")
    strAddress = Mid(strJSON, lngTemp + 22, InStr(lngTemp, strJSON, """,") - (lngTemp + 22))
    GEOAddress = strAddress
    
End Function

Happy Coding 🙂


It’s no secret that I’m a big fan of beautiful data visualizations. What may not be so obvious is that I’m huge on the KISS (keep it simple stupid) principle when it comes to getting work done. I believe that any moron can complicate things, but it takes a genius to simplify them. (On a separate note, I often recall a quote on life from one of my all-time favorite movies – “It is very simple to be happy, but it is very difficult to be simple”)

Today I’m sharing a simple tip on how you can highlight a data-point on your chart, based on a selection, without using VBA. And the best part is that it can be used for any chart type.

Chart - Highlight Data PointI have data for average precipitation in Delhi by month (for years 2000-2012). I have placed my data in cells A4:B15. Data validation has been put in cell B2 such that it can only take month names from January-December. Now that we are set up, follow these steps: (more…)


UntitledWe have earlier discussed how to hide errors in a worksheet in this post. Today I’m going address another similar problem that is very commonly faced. There are various ways to tackle it and there is no right or wrong about it. I’m sharing what I prefer to use (because I find it very simple and easy to implement).

Suppose I have a data table in my dashboard that is referencing to another range. My table has 10 rows (A2:D11) that reference range Z2:AC11. As long as there is data in Z2:AC11, everything is fine.

TableNow suppose that I have data only till row 4. In this case, my table shows 0’s which looks ugly and I’d rather prefer those cells to be blank. How do I solve this problem?

table2 (more…)

Network relationship chart

Posted: November 6, 2014 by MaxFraudy in Excel
Tags: ,

This is great…

User Friendly

I’m a big fan of anyone who can display data in a visual way.  Well today, rather than displaying my own work or giving a “how to” guide, I thought I’d display work from Chandoo.org – one of the best sites for Excel help.  This network / stakeholder relationship chart is a work of art and needs no explanation from me.  The full tutorial and example template can be found here: http://chandoo.org/wp/2014/08/13/network-relationship-chart/

Hope you find it as inspiring and as useful as I did!

+Alesandra Blakeston

network-relations-chart-demo

View original post


UntitledToday, I’m sharing a basic but nonetheless a neat trick to make your reports more presentable. I’ll take an example to illustrate my point.

I have Life Expectancy data for various countries for years 2011 and 2012.  The fourth column is calculated using data in B & C columns. The number of rows of data can change, so I have put formula in extra rows. The problem then is that the rows that don’t have data return #DIV! error in column D as below. (more…)


This is a common requirement while creating dashboards. One selects an option and the charts update to show data for that particular selection. It would be very useful if the same chart could show you how that particular selection fares against average or a set benchmark.

Comparison Chart Against AverageLet’s take an example. I have data for a class of students with their subject marks. I make a selection of the student name, his marks for each subject are plotted on a chart. I wish to see how this particular student has performed in each subject as against the class average. This custom chart does just the same, and it can be very very easily created in Excel as below:

(more…)


In my experience I have come across numerous people who so wish that their charts are ‘Interactive’. I’m sure many of you would like to select a data point on your chart and let it act as a selection for sort of a drill-down. Doing this, although not impossible in Excel, requires sound understanding of Class Modules and chart events. I have tried to create a small example to illustrate this.

Problem Statement:I have  data for daily site views for USA, Canada and the rest of North America. While there is a top chart that shows the cumulative counts, I would like to select a data point on the chart and see a detailed view for it as below.

Chart Event Example

Chart Event Example

(more…)


UntitledWhen working with a hierarchical data, most often we need to view at various levels of hierarchy. One of the ways of getting it done is using Data List Outline feature of Excel. To better demonstrate what I’m talking about, let me take an example.

I have the following data – the first column contains the month name, the second column contains the region name and the last column has the sales.

Raw Data

Raw Data

(more…)

Large Operation Warning: Excel

Posted: September 12, 2013 by Theodoulus in Excel
Tags: ,

We generally see a “Warning Dialogue Box” like:

large operation warning

This is seen when we try to put a formula, value or formatting to a big range (many cells) at a time in Excel worksheet.
So the good part is, we can modify the number of cells for which the dialogue box gets popped-up. And how do we do this:

Simply, Open Excel File -> Goto Excel Options-> Goto Advanced Tab -> In Editing Options, we can find one option like highlighted below:

large operation warning Solution

 

 

We can set any number in the box given there (in Thousands).

Now, if we perform any calculation on the a bigger range than specified, the Warning will be popped-up.

Opening URL @ new tab in Internet Explorer: VBA

Posted: September 11, 2013 by Theodoulus in Excel, General Tips, VBA
Tags:

Problem Statement: Suppose, we have an array of URLs and we need to open them one by one. By looping over all the URLs on the same tab at internet explorer, we need to check the internet explorer is in LOADED or LOADING state. If the explorer is in loading state, it may give an error. And by default, the URL will be opened on the same tab.

So the process of opening URL on the same tab will be lengthy in terms of Coding, and processing time.

Solution:

We can use different tabs of the Internet Explorer so that we would not have to check the READYSTATE and to REFRESH the tab again and again. The example is given below:

Option Explicit

Sub OpenURLOnNewTab()

    Dim lngC As Long
    Dim strUrl  As String
    Dim ieObj   As InternetExplorer

    Set ieObj = New InternetExplorer
    ieObj.Visible = True
    strUrl = "https://usefulgyaan.wordpress.com/"       'We have taken one URL but you can take an array of URLs

    For lngC = 1 To 100
        ieObj.Navigate2 strUrl, 2048            '2048 is to open the URL on the new tab
    Next lngC

End Sub