Matrix Coding and Crosstab Queries

  1. Next up are Matrix Coding queries. These allow you to see coding intersections between two lists of items. For example, let’s say you want to see which interviewees by cases had the most positive and negative attitudes based on coding - you can do this with a Matrix Coding query. Go to the Explore menu and select Matrix Coding.

    Explore menu with Matrix coding highlighted.

  2. This query is formed using drag and drop. First, using the left menu, under Cases, go to Cases, and then People, and then expand Interview Participants.

    In the left menu, under Cases, a red box around the People folder. In the People folder, a red box around the expand button for Interview Participants.

  3. Highlight all of the interviewees by clicking on the first one, holding down the Shift key, and then clicking on the last one. Then drag and drop them on the left side of the matrix query under Rows.

    Under Interview Participants, all cases are selected and outlined in red, with an arrow pointing to the Rows field of the Matrix Coding Query window.

  4. Then, using the left menu, under Coding, click on Codes, and then go to Attitude and expand it.

    In the left menu, under Codes, a red box around the Codes folder. In the Codes folder, a red box around the expand button for Attitude.

  5. Highlight all the attitude child codes (similar to the cases) and then drag and drop them on the right side of the matrix query under Columns.

    Under Attitude, all child codes are selected and outlined in red, with an arrow pointing to the Columns field of the Matrix Coding Query window.

  6. Click on Run Query to see the results. You will see a grid or matrix with the number of references where those codes and cases intersect.

    Query window with Run Query highlighted.

  7. To see the results more clearly and point out interesting patterns, go to the View menu from the top menu bar. From there, select Coding Matrix and then select Blue-White Shading.

    View menu highlighted. Coding Matrix Highlighted with drop-down menu open and Blue-White Shading highlighted.

  8. We can see that the darker the colour, the more two items intersect. In this case, we can see for example that Barbara had strong positive and negative references, Thomas’s interview was more negative than positive, and William’s was only positive.

    In the Matrix Coding Query window, a red box around the results table.

  9. Once you have finished examining the results, close the query results tab using the View menu and selecting Close “Unsaved Query” or hovering over the tab and selecting the X.

    Under the View drop-down menu, Close "Unsaved Query" is highlighted.

  10. Let’s move on to the last query we will look at, Crosstab queries. Crosstab queries are similar to Matrix Coding queries, but you can expand out all the categories for an attribute along the columns automatically. For example, you could determine which codes came up most by Township of respondent. Go to the Explore menu, and from the Queries drop-down menu, select Crosstab…

    Explore menu with Queries and Crosstab highlighted.

  11. This query is partially formed using drag and drop. First, using the left menu, under Coding, go to Codes. Highlight all the top-level codes (make sure none of the Code categories are expanded) and then drag and drop them under Codes on the Crosstab query tab.

    In the left menu, under Codes, a red box around the Nodes folder. Under Codes, all codes are selected and outlined in red, with an arrow pointing to the codes field of the Crosstab Query window.

  12. The default option for the Crosstab is codes against attributes. Under Classification, select Person from the drop-down menu.

    In the Crosstab Query window, drop-down menu under Classification is open with Person highlighted.

  13. Under Attributes, select Township from the drop-down menu. This Crosstab query will create a matrix where the codes are along the rows, and for the columns, it will take all the values of one attribute (in this case, Township) and use those for the column headers. Then it will tally where they intersect.

    In the Crosstab Query window, drop-down menu under Attributes is open with Township highlighted.

  14. Click on Run Query at the top to see the results (might have to scroll up to the top of that window to see the button). You will see a matrix with the number of references where those codes and attributes intersect.

    In the Crosstab Query window, Run Query is highlighted.

  15. To see the results more clearly and point out interesting patterns, click on the Results tab above where you specified the parameters of the query. Under Heatmap, select the top left option going from green to white.

    In the Crosstab Query window, the Results tab is highlighted. Under Heat Map the top left option from green to white is selected.

  16. We can now see that the darker the green, the more two items intersect in our grid now.

    In the Crosstab Query Results window, a red box around the results table.

  17. In this Results tab, at the top, you’ll see a section called Show Results As. You can change the selection, to alter what numbers are displayed in the grid. In this case, try selecting Coding Presence. Often times you might not have a big enough data set to gain meaning from the numerical values for coding references, for example, but you can at least see where there is an intersection at all or not. For example, we see that the codes of “Attitude” and “Sense of Community” aren’t connected to any of the townships. Normally people don’t report these numbers, but use them to gain insight into their project.

    In the Crosstab Query window, the Results tab is open. Under Show results as Coding presence is highlighted. A red box around the results table.

  18. You’ll see that NVivo also offers Coding Comparison Queries, which are used when working on a team to see how much agreement there is between team members on coding. I encourage you to play around with this query and all of the other queries we’ve already discussed on your own time to learn more.

Test Your Understanding 3

Run a Matrix Coding query on social media content only, where the columns are the attitude child codes (positive, negative, etc.) and the rows are the remaining top-level codes (Balance, Economy, etc). What two codes have the most negative references?

Next run a Crosstab query, where the rows are the top-level codes (Balance, Economy, etc) and the Person attribute is Education Level. What code was coded the most by coding references for people whose highest level of education completed is undergraduate college?

Click here for the answers.

Technique: Qualitative Data Analysis | Tools: NVivo


First created: November 20, 2023
Last updated: May 12, 2026

Tutorial maintained by Kelly Schultz.

Tutorial created by Kelly Schultz.

Creative Commons Attribution-NonCommercial-ShareAlike 4.0 International icon