Tag: Excel

  • 17. How to use conditional functions COUNTIF, SUMIF, AVERAGEIF, and MAXIFS in Excel and Google Sheets

    #conditonalfunctions #COUNTIF #SUMIF #AVERAGEIF #MAXIFS #Excel #GoogleSheets

    Conditional functions perform a specific task, but only on cells that satisfy some defined criteria. They are frequently used when constructing more complex queries.

    Assume you have the following sales dataset in A1:E11

    1️⃣ COUNTIF

    Objective:

    Count how many sales were made in the South region.

    Excel:

    =COUNTIF(C2:C11; “South”)

    Explanation:

    • C2:C11 → range to evaluate
    • “South” → criterion

    This counts all rows where Region = South.

    The same in Google Sheets

    =COUNTIF(C2:C11;”South”)

    2️⃣ SUMIF

    Objective:

    Calculate total revenue generated by Alice.

    =SUMIF(B2:B11;”Alice”;E2:E11)

    Explanation:

    • B2:B11 → criteria range
    • “Alice” → condition
    • E2:E11 → sum range

    This adds revenue only where Salesperson = Alice.

    3️⃣ AVERAGEIF

    Objective:

    Find the average revenue for Laptop sales.

    =AVERAGEIF(D2:D11;”Laptop”;E2:E11)

    Explanation:

    • D2:D11 → criteria range
    • “Laptop” → condition
    • E2:E11 → average range

    Returns the average revenue of all Laptop transactions.

    4️⃣ MAXIFS

    Objective:

    Find the maximum revenue generated in the North region by Alice.

    =MAXIFS(E2:E11;B2:B11;”Alice”;C2:C11;”North”)

    Explanation:

    • E2:E11 → max range
    • B2:B11, “Alice” → first condition
    • C2:C11, “North” → second condition

    Returns the highest single revenue value where both conditions are met = 1300.

  • 14. How to use Pivot tables in Excel

    #PivotTable #Excel

    Pivot tables allow us to organize the data more methodically in complex sheets. Starting from a complex sheet like this:

    After removing all filters, create a Pivot Table in a new Excel sheet from the Insert → PivotTable menu (same command for Goggle Sheets)

    Then select the necessary fields in the top right pane.

    Enlarged view:

    Practical examples of Pivot tables are available in my article Excel, Copilot and Google My Maps for data journalism.

  • 3. How to create a custom table in BigQuery from an Excel file (e.g. Istat database for birth names in Italy)

    From BigQuery console create a new project:

    Create a new dataset clicking on the three dots in the Explorer pane:

    Select this new dataset to create a new table clicking on + Create table:

    [As an example, I downloaded an Excel file from

    https://demo.istat.it/app/?i=FE3&l=it

    Then the Excel file was converted in CSV, saved as .txt and simplified with these 3 columns:

    Immagine che contiene testo, schermata, Carattere, numero

Il contenuto generato dall'IA potrebbe non essere corretto.]

    To create a table in Big Query from this file, select +Create table:

    Then Upload your table in CSV format, detailing data format with a schema (Anno=integer,Nome=string,Nati=integer)

    Immagine che contiene testo, schermata, numero, Carattere

Il contenuto generato dall'IA potrebbe non essere corretto.Click on the new table to see a preview:

    Compare to the txt file uploaded to check the results:

  • Excel, Copilot and Google My Maps for data journalism

    This is what I learned in the webinar “Kickstart your data journalism #1: Excel” by Arena for data journalism with Adriana Homolova/Jonathan Stoneman on 17th March 2025

    Source Excel file downloadable from www.eea.europa.eu

    Question 1: “Who pollutes the most in terms of chemicals?”

    Choose all columns (or the column Q of emissions only), from the menu Data > Filter to see the down arrow, click on this arrow to sort from maximum to minimum value.

    Choose to expand selection in pop-up window

    To obtain

    Question 2: “Who pollutes the most in terms of Mercury?”

    Option 1: apply filter to column (N) of pollutant and search for Mercury

    Or better

    Option 2:

    Choose Text Filters – Contains

    Question 3: “Who polluted the most in terms of Mercury in 2022?”

    Filter by 2022 as below

    And sort column Q of emissions from biggest to lowest value

    Remember to filter for Mercury

    Question 4: Knowing that Italy has these results, we want to exclude it from the list of countries to see which other country has the same issues.

    Filter the first column (country_name) and deselect Italy.

    Question 5: Which country has released the most arsenic into the water?

    Apply Text Filters – Contains Arsenic to column N of pollutant and sort

    Pivot table

    To organize the data more methodically, for example by year and by country, use Pivot Tables.

    After removing all filters, create a Pivot Table in a new Excel sheet from the Insert → PivotTable menu

    Question 6: Which country pollutes the most?

    Drag the field *pollutant* in the Filters pane, the field *country_name* in Rows e the field *emissions* in Values (Sum) of the Pivot table.

    Right click on any value to sort them, e.g. from biggest to lowest

    Question 7: Which country pollutes the most in terms of Arsenic?

    Search the term arsenic in column B of the row pollutant

    Question 8: Which facility pollutes the most in terms of Arsenic?

    Add the field facility_name in the Pivot table rows to see the facility name.

    It is possible to expand or reduce this view for each country.

    Question 9: Which was the trend of Arsenic pollution in the last years?

    Add the column reportingYear to the Pivot table columns

    Rolling the mouse over a value, e.g. over the total for Serbia of 9454,9 it is possible to see the description

    Double click on a value to obtain the details

    Question 10: How to create a map of the top ten facilities involved in arsenic pollution in Serbia?

    Sort the by emissions and copy the first 10 rows in a new Excel file to create a map.

    Create an account and open Google MyMaps, import the Excel file

    Select longitude and latitude

    Then select facility_name

    Then select single styles by eptr_sector_name

    Copilot

    Question 11: Which Polish power plant emitted the most in 2018?

    In data excel file

    Always check the results, e.g. with a Pivot table.

    Filter by country_name (Poland), eptr_sector_name (energy) and reporting Year (2018)

    And right click on any value in the column Sum of emissions to be able to sort

    We obtain the same value as Copilot.