
When working with Excel data, it is common to have multiple tables with the same structure stored in different ranges.
Manually combining and summarizing these tables can quickly become time-consuming and error-prone.
In this tutorial, you will learn how to merge multiple tables into one using Power Query.
Then, you will calculate totals by code using simple grouping logic.
This approach automatically updates when new data ranges are added, making it ideal for scalable workflows.
Power Query를 활용해 여러 범위로 나뉘어진 데이터를 하나로 합친 뒤 코드별 합계를 구하는 방법을 정리했습니다.
엑셀에서 데이터를 관리하다 보면 동일한 구조의 데이터가 여러 범위에 나뉘어 있는 경우가 많습니다. 예를 들어 1범위, 2범위, 3범위처럼 데이터가 따로 존재하지만 열 구조는 동일한 상황입니다.
각 범위에는 다음과 같은 동일한 열이 포함되어 있습니다.
- 코드
- 항목
- 개수
이 경우 각 범위를 하나로 합친 뒤 코드 기준으로 개수를 합계해야 하는 작업이 자주 발생합니다.
엑셀 함수로도 처리할 수 있지만, 데이터 범위가 추가되거나 구조가 변경되면 관리가 복잡해질 수 있습니다.
Power Query를 사용하면 이러한 작업을 보다 간단하게 자동화할 수 있습니다.
먼저 각 범위를 Power Query로 불러와 각각의 쿼리를 생성합니다. 예를 들어 범위1, 범위2, 범위3과 같은 형태입니다.
그 다음 Table.Combine 함수를 이용해 여러 쿼리를 하나의 테이블로 합칩니다. 이후 Table.Group을 사용하여 코드와 항목을 기준으로 개수 합계를 계산합니다.
이렇게 구조를 만들어두면 새로운 범위가 추가되더라도 쿼리만 추가하고 새로고침하면 자동으로 전체 데이터가 합쳐지고 합계까지 계산됩니다.
Power Query를 활용하면 여러 범위 데이터를 하나로 통합하고 반복적인 집계 작업을 효율적으로 처리할 수 있습니다.
Power Query, M code, 엑셀 자동화 관련 실전 예제를 계속 공유할 예정입니다.

videolink - https://youtu.be/uJhJF_rNVrM
Download the sample file below.
You can download the zip file in [자료실][Download] page
The file name is 09.합계구하기(combine_group total).
Use the English M code provided for your dataset.
✔ Download the ready-to-use Power Query template below
✔ Just copy and paste the M code – works instantly
The original sample file is based on a Korean dataset.
You can apply the English M code to adapt it to your own data.
--------------------------------
Need a custom automation for your Excel workflow?
I can build a tailored solution based on your data.
✔ Used in real-world business automation
✔ Saves hours of manual work
minbedata@gmail.com
You can pay via PayPal.
You can also contact me via Upwork for secure payment and project handling.
<a href="https://www.upwork.com/freelancers/~01eb52dbd212cffc17" target="_blank">
Hire me on Upwork
</a>
You don't worry about conversing with me.
My Major is an English literature, so I can speak English fluently and read, listening, writing proficiently
korean version web address (한국버전) is
<a href="https://blog.naver.com/minbe-data" target="_blank">네이버 블로그 바로가기</a>