Back to IQAir AirVisual in Excel
SheetXAI logo
IQAir AirVisual logo
IQAir AirVisual · Excel Guide

Rank Office Cities by Live AQI Into a Excel

2026-05-14
5 min read

The Scenario

The sustainability report goes to the executive team in two weeks. Your manager wants a slide showing the air quality ranking for all 20 global office cities — cleanest to most polluted, with current AQI — and they want it sourced from live data, not last quarter's numbers.

You have the city list in an Excel workbook. What you do not have is a workflow for getting live AQI into it without spending an hour on manual lookups.

The bad version:

  • Open IQAir for each of the 20 cities, read the AQI, record it in a separate notes doc, paste the values into the workbook, and then sort manually.
  • Realize that you pulled the cities in a random order and the sort mixed up the original city groupings that had regional labels in an adjacent column.
  • Pull a second time an hour later to verify some values you were not sure about, which now produces two sets of numbers that do not quite match.

The slide needs to show a clean ranked list sourced from live data at a specific timestamp. Manual entry across twenty lookups does not give you that.

The Easy Way: One Prompt in SheetXAI

SheetXAI is an AI agent inside your Excel workbook. It reads your office city list, fetches live AQI from IQAir AirVisual for each location, and sorts the ranked output into a new worksheet in one step.

I have 25 cities in column A of my Excel sheet. Pull their current AQI from IQAir, add the AQI values in column B, and sort the entire sheet by AQI descending so the most polluted cities appear first.

What You Get

  • Column B: current US AQI for each city at time of pull.
  • The worksheet sorted by AQI descending, most polluted at the top.
  • Cities where IQAir returns no data come back at the bottom with a status note.

What If the Data Is Not Quite Ready

Some office cities are listed informally and IQAir does not recognize the name

Column A in my Office Locations workbook has informal city names like Bay Area instead of San Francisco. Resolve each informal name to the nearest IQAir-recognized city, then fetch current AQI, add it in column B, and sort the worksheet by AQI descending.

You need the ranking split by region

Fetch current AQI for all 20 cities in my Office Locations workbook, add the AQI values in column B, and sort the workbook by AQI descending within each region group from column C, so cities are ranked cleanest to most polluted within each region.

The workbook has a column of office headcount and you want a weighted ranking

Fetch current AQI for all 20 cities in my Office Locations workbook, add AQI in column B, and add a column C showing AQI multiplied by headcount from column D, which represents total environmental exposure across each office. Sort by column C descending.

Pull AQI, rank, add category labels, and flag the top three most polluted in one shot

Fetch current AQI for all 20 cities in my Office Locations workbook, add AQI in column B, sort by AQI descending, add a label column C using Good for AQI below 51, Moderate for 51 through 100, Unhealthy for Sensitive Groups for 101 through 150, and Unhealthy above 150, and flag the top three most polluted cities with Escalate in column D.

One prompt for the full ranked and labeled output.

Try It

Get the 7-day free trial of SheetXAI and open the workbook with your office city list, then ask it to pull live AQI, sort by pollution level, and apply the category labels. For related workflows, see the spoke on pulling historical AQI trend data, or the hub overview on connecting IQAir AirVisual to Excel.

Stop memorizing formulas.
Tell your spreadsheet what to do.

Join 4,000+ professionals saving hours every week with SheetXAI.

Learn more