---
title: Distance-Based Office Matching | Case Study | Ramach Ops
description: How an n8n and HubSpot workflow associates contacts with the right regional office by distance instead of fragile city-name matching.
---

[![Ramach Ops](https://ramachops.com/hs-fs/hubfs/Ramach%20Ops%20Logo%20(2000%20x%20500%20px)%20(2).png?width=170&height=43&name=Ramach%20Ops%20Logo%20(2000%20x%20500%20px)%20(2).png)](https://ramachops.com/?hsLang=en)

[Services](https://ramachops.com/services?hsLang=en)

[HubSpot Systems Audit](https://ramachops.com/services/hubspot-systems-audit?hsLang=en) [Fractional RevOps](https://ramachops.com/services/fractional-revops?hsLang=en) [Software Integrations](https://ramachops.com/services/software-integrations?hsLang=en) [Custom Tools & AI Automation](https://ramachops.com/services/custom-tools-ai-automation?hsLang=en)

[My Work](https://ramachops.com/my-work?hsLang=en) [About](https://ramachops.com/about?hsLang=en) [Schedule a Consultation](https://ramachops.com/schedule-a-consultation?hsLang=en)

Case study · Custom Tools & AI Automation

# Distance-Based Office Matching

Contacts needed to be linked to the right regional office in HubSpot. Matching by city name kept failing, so I built a workflow that matches by distance instead.

n8nHubSpot APIAssociations

The problem

City-name matching missed anyone outside an office's exact city, and fixing associations by hand was slow and inconsistent.

What I built

An n8n and HubSpot workflow that associates each contact with the correct office based on distance from the contact's city.

The result

Contacts linked to the right office without manual lookups, including those outside an office's exact city.

The problem

## City names are a fragile way to match

The business's customers operate out of many regional offices, and each contact in HubSpot needed to be associated with the right office record. Matching on city names was the obvious approach, and it broke constantly. A contact in a suburb, a neighboring town, or a city spelled slightly differently didn't match anything, and associating them by hand was slow and inconsistent.

What I built

## Match on geography, not spelling

I built an automated workflow in n8n and HubSpot that matches contacts to offices by distance rather than by name. It takes the contact's city, works out how far it is from each office, and associates the contact with the correct office company record.

[View the full walkthrough (PDF)](https://ramachops.com/hubfs/Automatic%20Office%20Matching%20for%20HubSpot%20-%20Jason%20Ramach.pdf?hsLang=en)

Design decisions

## Solve the real problem, and no more

### Distance over names

Matching on geography instead of exact text handles suburbs, neighboring towns, and spelling differences.

### Reviewed, not blindly trusted

It runs on demand, and its output gets reviewed periodically rather than assumed to be right.

### Documented

The system is fully documented so it can be maintained and handed off.

The result

## The right office, without the lookups

Contacts end up associated with the correct office without manual research, and the matching holds up for contacts outside an office's exact city.

[More about Custom Tools & AI Automation](https://ramachops.com/services/custom-tools-ai-automation?hsLang=en)

## Have a matching or routing problem?

Tell me where records aren't landing where they should. I'll tell you how I'd fix it.

[Schedule a Consultation](https://ramachops.com/schedule-a-consultation?hsLang=en) [More work](https://ramachops.com/my-work?hsLang=en)

Ramach Ops

RevOps and GTM systems for B2B teams running on HubSpot. Based in Denver, Colorado.

[Schedule a Consultation](https://ramachops.com/schedule-a-consultation?hsLang=en)

Services

[HubSpot Systems Audit](https://ramachops.com/services/hubspot-systems-audit?hsLang=en) [Fractional RevOps](https://ramachops.com/services/fractional-revops?hsLang=en) [Software Integrations](https://ramachops.com/services/software-integrations?hsLang=en) [Custom Tools & AI Automation](https://ramachops.com/services/custom-tools-ai-automation?hsLang=en)

Explore

[My Work](https://ramachops.com/my-work?hsLang=en) [About](https://ramachops.com/about?hsLang=en) [Contact](https://ramachops.com/schedule-a-consultation?hsLang=en)

Connect

[LinkedIn](https://www.linkedin.com/in/jason-ramach/)

© 2026 Ramach Ops · [Privacy Policy](https://ramachops.com/privacy-policy?hsLang=en)