Skip to content

Excel to Julia: The Rosetta Stone

Table of Contents

For when your spreadsheet starts to crawl, but you still need to get the job done.

1. The Basics: Data as a Thing

In Excel, the data and the logic live in the same cell. In Julia, we keep them separate for speed and sanity.

  • Workbook/SheetDataFrame
  • Column:Symbol or "String"
  • Celldf[row, col]
Excel ActionJulia (DataFrames.jl)Why it’s better
Open Filedf = CSV.read("data.csv", DataFrame)Handles millions of rows in seconds.
Filter Rowssubset(df, :Status => x -> x .== "Active")No more "filtering" then copy-pasting to a new sheet.
New Columndf.Total = df.Qty .* df.PriceThe formula is applied to the whole column instantly.
Pivot Tableunstack(df, :RowName, :ColName, :Value)Reproducible. If the data changes, just re-run the script.

2. The Big Three Functions

These are the most common Excel idioms translated into the Julia ecosystem.

VLOOKUP / XLOOKUP ↔️leftjoin

In Excel, you look up a value cell-by-cell. In Julia, we "join" the two tables based on a common ID. It’s safer because it prevents "broken" references.

Julia

# Excel: =VLOOKUP(A2, 'Prices'!A:B, 2, FALSE)
combined_df = leftjoin(sales_df, price_list, on = :ProductID)

IF / Nested IF ➡️ ifelse or case

Instead of a nightmare of nested parentheses, Julia uses vectorized logic.

Julia

# Excel: =IF(A2 > 100, "High", "Low")
df.Category = ifelse.(df.Amount .> 100, "High", "Low")

Pivot Tables ➡️groupby & combine

This is where Julia shines. You can summarize data with surgical precision.

Julia

# Create a summary of Total Sales by Region
summary = combine(groupby(df, :Region), :Sales => sum)

You try

Download the script and sample spreadsheet

Latest

Using the forum at Julialang.org

The Julia language organization maintains an open, free forum where you can post questions to the helpful users under the New to Julia category. Especially if your question involves advanced scientific capabilities of the language, such as tensors, it will be invaluable. On the other hand … If you are an

Members Public

Age pyramids

The age pyramid is a useful tool in demographic analysis. It visualizes the relative proportion of population by sex and age cohort. The shape of the curve can indicate an excess of deaths over births and give an idea of the sufficiency of the working age population to support the

Members Public
Do It Yourself Bullseye Maps

Do It Yourself Bullseye Maps

Do It Yourself Bullseye Maps Bullseye maps are useful for orientation at the regional level. These are easy to assemble through the facilities of the Open Maps Project using the Leaflet API. Most of what this function does is to output HTML code with Javascript, which does the work. The

Members Public