Archive

Archive for the ‘Excel’ Category

Excel 2010 Ctrl combination shortcut keys

July 20th, 2011 admin No comments

L.S.

Found this great pdf with Excel 2010 Ctrl combination shortcut keys.

enjoy

Categories: Excel Tags:

Strange VBA Code

July 15th, 2011 admin No comments

L.S.

I recently came upon some vba code in a workbook from the Hong Kong branch.
There were a lot of construction in there like:

Range(ThisWorkbook.Names("RANGE_NAME").RefersTo).ListObject.QueryTable.Refresh
Range(ThisWorkbook.Names("RANGE_NAME").RefersTo).Cells(1, 1).Value

Does anybody know why someone would code like this….?

regards..

Categories: Excel, VBA Tags: ,

Great article about using MDX in OLAP Pivottables (PowerPivot)

July 12th, 2011 admin No comments

L.S.

I found this great article Quartile, Percentile and Median in PowerPivot. It’s about using MDX in OLAP Pivottables and the ability to perform COM interop calls through the ExcelMDX assembly.
It’s not to long but I’m sure I will spend a lot of time putting it to use…

thnx Javier Guillen

Microsoft PowerPivot Code-Named Denali CTP3 Release Notes

July 11th, 2011 admin No comments

As noticed by @dhExcel Microsoft published this but removed it from there site shortly after, but google cached it here.

1.0 What’s New

The Microsoft SQL Server Code-Named “Denali”, Community Technology Preview 3 (CTP 3) release of PowerPivot for Excel includes the following new features:

Diagram View. The Diagram View is available on the Home tab of the PowerPivot window, and it enables you to view tables in a visually organized way and to easily add and change relationships and hierarchies. For more information, see the PowerPivot Window: Diagram View Help topic.

Hierarchies. A hierarchy is a list of child nodes that you can create from columns and place into any order you want, making it easier for reporting client users to select and navigate the common paths of data. For more information about hierarchies, see the Hierarchies in PowerPivot and Create a Hierarchy in a Table (Tutorial) Help topics.

Relationships in Diagram View. In Diagram View, you can easily create relationships between columns in separate tables. The relationships appear visually, which enables you to quickly see how all the tables relate to each other. For more information about Relationships in Diagram View, see the Create Relationships Between Tables (Tutorial) Help topic.

Multiple Relationships. We added the ability to import multiple relationships. The first relationship is active, and the other relationships are inactive and appear as dotted lines in Diagram View. For more information, see the PowerPivot Window: Diagram View and Create Relationships Between Tables (Tutorial) Help topics.

Measure Grid. The Measure Grid enables you to view measures in a grid pattern and to easily create, edit, and manage measures and Key Performance Indicators (KPIs) within the model. For more information, see the PowerPivot Window: Measure Grid and Create a Measure and KPI (Tutorial) Help topics.

Advanced Tab. The advanced features are now available in a separate tab. The features include the ability to create or edit perspectives, summarize a numeric column by an aggregation function, and set reporting properties for a reporting client tool, such as Project Crescent. For more information, see the PowerPivot Window: Advanced Tab Help topic.

Reporting Properties. In the Reporting Properties area of the Advanced tab, you can set the table identifier, group values based on a table identifier, add table details, set the representative column, set an image URL, and set the representative image for reporting client tools, such as Project Crescent. For more information, see the PowerPivot Window: Advanced Tab Help topic.

New DAX Function. We added a new function to enrich the relationship feature:

USERELATIONSHIP Function. Specifies one or more relationships to be used in a specific calculation. For more information, see the USERELATIONSHIP Function (DAX) Help topic.

Sort by Other Column. If you do not want to sort your column alphabetically, you can now sort your column by another column. For example, you can sort by a month number column that assigns each month its number in order to sort the column in a natural way.

Add Values to Rows and Columns. You can now add values to rows and columns.

Blob Support. You can now import images and blobs. Blob data is now automatically detected and accepted as a binary data type.

Other Tab Changes. We moved the ribbon features around in the Home and Design tabs slightly, based on customer feedback and usability studies.

Home Tab. The Freeze and Column Width buttons were added to the Design tab. The View area was added with the Data View, Diagram View, Show Hidden, and Measure Grid buttons. For more information about the new Home tab, see the PowerPivot Window: Home Tab, PowerPivot Window: Diagram View, and PowerPivot Window: Measure Grid Help topics.

Design Tab. The Hide and Unhide button was removed and became the new Show Hidden button that was added to the Home tab. The Mark as Date Table button was added. When you switch to Advanced Mode, the Advanced area is no longer added to the Design tab (the Advanced tab is added instead). For more information about the new Design tab, see the PowerPivot Window: Design Tab Help topic.

In addition, the following features were added to previous SQL Server Code-Named “Denali” releases of PowerPivot:

Perspectives. With the Advanced Mode’s Perspectives feature, you can add, edit, delete, copy, and view perspectives. Perspectives are metadata layers that track different slices or sets of data. Perspectives are typically defined for a particular user group or business scenario and make it easier to navigate large data sets. For more information, see the Perspectives in PowerPivot and Perspectives Dialog Box Help topics.

Key Performance Indicators. A KPI is based on a specific measure and is designed to help evaluate the current value and status of a metric. For more information, see the Key Performance Indicators (KPIs) in PowerPivot and Key Performance Indicator Dialog Box Help topics.

Date Table Settings. You can mark a table as date table, which will enable you to leverage date filtering in Excel. For more information, see the Date Table Settings Dialog Box Help topic.

Show Details. Right-click a cell in a PivotTable in Excel, and then click Show Details. A new worksheet opens with the underlying data that contribute to the value of the specified cell. For more information, see “Show Details” in the Create a PivotTable or PivotChart Report Help topic.

New DAX Functions. We added several new functions to extend the language in areas that were requested the most by our customers:

Statistical Functions. For more information, see the Statistical Functions (DAX) Help topic.

DISTINCTCOUNT. Return a distinct count of cells (DISTINCTCOUNT()). For more information, see the DISTINCTCOUNT Function (DAX) Help topic.

Generate Cross Content. Statistical table functions to generate cross content (CROSSJOIN(), GENERATE(), GENERATEALL()). For more information, see the CROSSJOIN Function (DAX), GENERATE Function (DAX), and GENERATEALL Function (DAX) Help topics.

Rank. Rank a set of values (RANK.EQ(), RANKX()). For more information, see the RANK.EQ Function (DAX) and RANKX Function (DAX) Help topics.

Standard Deviation. These functions were added to calculate the standard deviation of the entire population or a sample (STDEV.S(), STDEV.P(), STDEVX.S(), STDEVX.P()). For more information, see the STDEV.S Function (DAX), STDEV.P Function (DAX), STDEVX.S Function (DAX), and STDEVX.P Function (DAX) Help topics.

Statistical Table Functions. These functions enable you to create aggregated table content (SUMMARIZE(), ROW()) or to temporarily add columns to existing tables (ADDCOLUMNS()), without having to create calculated columns. For more information, see the SUMMARIZE Function (DAX), ROW Function (DAX), and ADDCOLUMNS Function (DAX) Help topics.

TOPN. Select the top elements of a set (TOPN()). For more information, see the TOPN Function (DAX) Help topic.

Variance. Calculate the variance of the entire population or a sample (VAR.S(), VAR.P(), VARX.S(), VARX.P()). For more information, see the VAR.S Function (DAX), VAR.P Function (DAX), VARX.S Function (DAX), and VARX.P Function (DAX) Help topics.

Information Functions. For more information, see the Information Functions (DAX) Help topic.

LOOKUPVALUE. Informational search functions to look up a certain value from a table (LOOKUPVALUE()) or to assess whether a value or combination of values in a row exist in a table (CONTAINS()). For more information, see the LOOKUPVALUE Function (DAX) and CONTAINS Function (DAX) Help topics.

Parent-Child Relationships. Informational parent-child functions (PATH(), PATHCONTAINS(), PATHITEM(), PATHITEMREVERSE(), PATHLENGTH()). For more information, see the PATH Function (DAX), PATHCONTAINS Function (DAX), PATHITEM Function (DAX), PATHITEMREVERSE Function (DAX), and PATHLENGTH Function (DAX) Help topics.

SWITCH. Logical function to provide a multiple-choice selection of an option and action (SWITCH()). For more information, see the SWITCH Function (DAX) Help topic.

Filter Functions. For more information, see the Filter Functions (DAX) Help topic.

ALLSELECTED. Filter removal from columns and rows to have visual totals (ALLSELECTED()). For more information, see the ALLSELECTED Function (DAX) Help topic.

Context-Examination Functions. Filter context-examination functions (ISCROSSFILTERED(), ISFILTERED(), HASONEVALUE(), HASONEFILTER(), FILTERS()). For more information, see the ISCROSSFILTERED Function (DAX), ISFILTERED Function (DAX), HASONEVALUE Function (DAX), HASONEFILTER Function (DAX), and FILTERS Function (DAX) Help topics.

HASONEVALUE. Tells you what columns contain only one distinct value (HASONEVALUE()). For more information, see the HASONEVALUE Function (DAX) Help topic.

CURRENCY. Currency-casting math function (CURRENCY()). For more information, see the CURRENCY Function (DAX) Help topic.

Change Data Types. You can change the data type for a calculated column in the same way you can change the data type for all non-calculated columns. For more information, see “Changing the Data Type” in the Calculated Columns Help topic.

Number Formats for Measures. You can set the type of number format (such as Currency), enter how many decimal places you want to display, select a symbol you want to display with the numbers, and use a digit-grouping symbol (such as a comma) to separate the thousand place. For more information, see “Formatting Options” in the Measure Settings Dialog Box (Custom Aggregation) Help topic.

Formatting Persistence. Now when you apply formatting to columns in the modeling environment, the formatting persists as you add fields to value areas of a PivotTable.

Field List: Descriptions. Add descriptions to tables, measures, and key performance indicators (KPIs). When the user hovers over those tables, measures, and KPIs in the Field List, tooltips appear that feature your descriptions of the context of each field. For more information about the Field List, see the PowerPivot Field List Help topic.

Field List: Display Order of Tables and Fields. The Field List is now sorted alphabetically. For more information about the Field List, see the PowerPivot Field List Help topic.

Categories: Denali, Excel, PowerPivot Tags: , ,

Using MDX for ranking in a PowerPivot solution

June 29th, 2011 admin No comments

L.S.

I found this great article about using a combination of MDX and DAX in a pivottable based on a PowerPivot model. It explains a real world Ranking problem using this approach. It is definitely worth reading…

PowerPivot is ‘Rank’

enjoy

Using a computer with multiple versions of office installed in combination with Qlikview.

June 27th, 2011 admin No comments

We were experiencing problems with a qlikview report containing a script which mailed parts of a certain tab as embeded pictures.

The line of code qlikview errored on was: Set OutApp = CreateObject(“Outlook.Application”)

The error was: ActiveX component can’t create object: ‘Outlook.Application’

The user with this problem also had problems with sending a excel workbook as an attachment from excel and got the error message:

This led me to believe that the additional installation of some Microsoft Office 2003 products were the reason for this strange behavior. In Qlikview you don’t reference a version of the ActiveX component like in vba so I assume the latest installation is leading.

To prevent these kinds of errors one should do a repair of the office installation considered to be leading.

Categories: Excel, Qlikview Tags: ,

Entire London 2012 Olympics’ cultural events database held on Excel

June 8th, 2011 admin No comments

I have read this great article on the site of the Register written by Kelly Fiveash about a job vacancy currently advertised on the London Organising Committee of the Olympic Games (LOCOG) website.

If you’re in for a laugh you have to read this…

enjoy

Categories: Excel Tags:

Bottom left part of the UsedRange

June 6th, 2011 admin No comments

The csv file I import in my previous post contains two rows of informational data followed by a blank row followed by the real data. I needed to determine this range to loop though.
I decided to make a function and this is what I cam up with.

Feel free to shoot at it….

regards

Function DataRange(tmpWorkSheet As Worksheet) As Range

    Dim rTemp As Range

    Set rTemp = tmpWorkSheet.UsedRange.Columns(1)
    Set rTemp = rTemp.Cells(rTemp.Rows.Count, 1)
    Set rTemp = rTemp.CurrentRegion

    Set DataRange = rTemp

End Function
Categories: CSV, Excel, VBA Tags: , ,

Scheduled Import a online csv file into Workbook

May 27th, 2011 admin No comments

For a client I needed a solution for a scheduled import of a online csv file into a workbook. There are many ways to download files from the internet but it needed to be in excel as there were a whole lot of macro’s allready in place to transform and process the downloaded data. They had a machine running at all time ( not a server ) to be used.
So this is the code I came up with. It runs every day after it is started by running the StartSchedule Procedure

Option Explicit

Public tTime As Date

Sub StartSchedule()

    tTime = Now()
    Schedule

End Sub

Sub Schedule()

    tTime = tTime + TimeSerial(23, 59, 59)
    Application.OnTime tTime, "ImportCSV"

End Sub

Sub ImportCSV()

    Dim tmpSheet As Worksheet

    Set tmpSheet = ThisWorkbook.Sheets.Add(,,, "http://www.dummy.com/temp/file.csv")

    tmpSheet.Cells.EntireColumn.AutoFit
    tmpSheet.Name = tmpSheet.Name & " " & Format(Now(), "yyyy-mm-dd hh-mm-ss")

    Schedule

End Sub
 
Categories: CSV, Excel, VBA Tags: , ,

Importing varbinary fields into Excel

May 18th, 2011 admin No comments

I needed to compare two large datasets and find out if they contained the same records.
So I amended the records with a HashByte at the end so I could check if they existed in the other one.
First I imported both queries in Excel with the idea to do a lookup on them.
But a varbinary field is not imported in excel and it will return no error when ommitting a field,
except when the only field is a varbinary field then Excel willl tell you:

No columns that Microsoft Excel can use were returned from this query.

So I had to go back to the Management Studio and join the two sets which was a pain because they were on differend servers.
So much pain I kept trying to find a Excel solution.
All I had to do was convert the varbinary field by making it a parameter in a function which would return a normal varchar.

So

SELECT [field] FROM [table]

had tot change to

SELECT master.dbo.fn_varbintohexstr([field]) AS [field] FROM [table]

 

enjoy

Categories: Excel, SQL Tags: ,