Google Spreadsheet Query Function: Use real SQL on your spreadsheets


Just like this:

=query(Yevmiye!$A$2:$I$1004;“select sum(H) WHERE D=’”&A11&“’ label sum(H) ”“)

D is a column head. Ignore label statement. Sum(H) is the column which will be subject of query.

The formula gives sometimes #N/A due to result of SQL query is null. To be able to overcome it just wrap your function with iferror(param1,param2) function. if the first param1 gives error, function will threat param2 (in this case 0)

=iferror(query(Yevmiye!$A$2:$I$1004;"select sum(H) WHERE D=’”&A11&“’ label sum(H) ”“) ,0)

Enjoy

Reklamlar

Python for your digital errands


A programming language mostly considering as highly holy and celestial. No programmers want to do a trivial task with a programming language. For instance, there is no Java developer which resizes his photos with Java.

However, for Python something is different. Due to its clear looking, you can perform some of your daily tasks with Python.

From time to the time, I am writing Python function for excel instead of writing over-nested ifs. 

I have found an interesting book includes a lot of interesting practical daily recipes with Python. Here is this book:

Cover of book fills the bill. A robot mows the lawn. The robot is python and lawn are daily tasks.

Google Spreadsheet Query Function Makes your Spreadsheets DB which SQL-ready


When you want to make complex queries over Excel sheet that is almost impossible. Yet by Google Docs Spreadsheet Query() function you  can write SQL and retrieve whatever you want.

For instance:

=query(A2:I1000;“select sum(H)  WHERE D=‘mrkt’”) 

Gets only expenditures which about ‘mrkt’ (market) from A2:ı10000 TABLE then gets sum.

When you write function by this way, the function returns extra header. You can remove it:

=query(A2:I1000;“select sum(H) WHERE D=’mrkt’ label sum(H) ”“)

Enjoy.

WordPress.com'da ücretsiz bir web sitesi ya da blog oluşturun.

Yukarı ↑