It’s not always that when working with Google Sheets, the user needs to create a full-scale chart that touches the entire range of data. In this case, the built-in function comes to the rescue SPARKLINEwhich allows you to fit the graph in one cell, having previously selected the appropriate range for it.
If you came to this article for general information about using charts in Google Sheets, I recommend that you read another article, which has a section dedicated to classic charts and working with them.
Areas of application of charts built through SPARKLINE
Let’s briefly dwell on what charts are needed for, which we will then create using a special function in Google Sheets. Let’s say you have a table with various indicators of a specific employee, product, or other information that is distributed by days, months, or other periods. It is necessary to obtain visual statistics for each value from the table as a summary result, which had a graphical display. In this case, just right SPARKLINE.
However, there are many other areas of application, since the function is limited only by the syntax and the skills of the user himself. Using the same setting, you can create a dynamic scale that will show the progress of achieving goals. This topic with all the details is already discussed in my separate instructions on the site.
The community is now in Telegram
Subscribe and stay up to date with the latest IT news
A standard use of the SPARKLINE function
First, let’s understand the standard syntax of the function without the various arguments that affect the appearance of the chart. Let’s dwell on the declaration of the function, the selection of the range and the output results, so that you already roughly understand how the formula is written.
Select any empty cell next to a row in the table for which you want to display a chart. Declare the function via =SPARKLINE()and in brackets by selecting with the left mouse button, specify the first range of values.
For now, we are only analyzing the standard application of the function, so after selecting a range, you can simply close the parenthesis and click on Enter.
By default, a line chart is displayed. You can stretch a column or row to achieve the desired graph size.
Stretch the function over all other rows by pinching the lower right corner and dragging down.
You can leave the graph unchanged and not use additional arguments if you are interested in the classic linear version. However, it is often necessary to edit the chart type and add different colors for the columns or blocks, which will be discussed later.
Change the chart type
In the function line itself, you need to specify an argument that will allow you to change the chart type. I will talk about the options a little later.
The formula will need to be given in the following form:
In this case, the type is specified as columnthat is, instead of a linear one, there will be a bar chart. If you need a different type of diagram, enter the corresponding name in quotes (I will also talk about the names themselves later).
Remember that you don’t need to manually make changes to each cell that uses the charting function. Just drag the first cell down as shown above.
As you can see, in some cases, the bar chart displays the information from the tables in more detail and allows you to get the necessary information faster.
Change the color of the chart
By default, all the columns and lines of the chart are black, which is not always a suitable output. If you just need to specify the main color for the chart, write in curly brackets after the semicolon “color”\”red”replacing ed to any other color.
Additionally, you can specify both the color for the columns with the highest value and the minimum value, which will make the chart display clearer. I’m leaving the full function string below so you can just copy it and substitute some values for your table.
Pay attention to the following screenshot, which shows the result of applying the function SPARKLINE with all arguments for rows from the common table. Now it has the maximum visual display and perfectly fits into the overall design of the document.
Getting a list of all possible arguments for SPARKLINE
I already wrote above that I will give instructions that will help you find a list of all available arguments, familiarize yourself with it and make changes to the function SPARKLINE. You can do this right on the tab with the spreadsheet so you don’t have to switch to any help.
To begin, activate the cursor in any part of the function and in the window, click on the inscription “more details”.
Help from Google will appear on the screen on the right, where you will see an example of using the function and can understand its syntax.
Go to this window below to get to the syntax description. You will see what types of charts you can create through SPARKLINE and how to properly announce them.
Below are details on which colors to use and how to specify the correct arguments for all column and row types. This information is quite enough to use comfortably SPARKLINE.
So, in this article, you learned how to create small graphs and charts using a function within a single cell. Use this information to create full-fledged tables with a visual display of statistics, add dynamic bars or other elements implemented using SPARKLINE.