Discussion thread for day 3 of the Advent of Code - https://adventofcode.com/2025/day/3
The 1st day we need Iterative Macro, I think.
@gawa Day 3 going iterative does seem early... but who knows what will happen with a 12 day AoC this year?
throw all to multiple-row tool. 800+ chars.
glad i know excel to help.
formula if you interest
if length([row-1:max])<12 then
[row-1:max]+[data]
else
max(tonumber([row-1:max]),
tonumber(Substring([row-1:Max],1,12)+[data]),
tonumber(left([row-1:Max],1)+Substring([row-1:Max],2,12)+[data]),
tonumber(left([row-1:Max],2)+Substring([row-1:Max],3,12)+[data]),
tonumber(left([row-1:Max],3)+Substring([row-1:Max],4,12)+[data]),
tonumber(left([row-1:Max],4)+Substring([row-1:Max],5,12)+[data]),
tonumber(left([row-1:Max],5)+Substring([row-1:Max],6,12)+[data]),
tonumber(left([row-1:Max],6)+Substring([row-1:Max],7,12)+[data]),
tonumber(left([row-1:Max],7)+Substring([row-1:Max],8,12)+[data]),
tonumber(left([row-1:Max],8)+Substring([row-1:Max],9,12)+[data]),
tonumber(left([row-1:Max],9)+Substring([row-1:Max],10,12)+[data]),
tonumber(left([row-1:Max],10)+Substring([row-1:Max],11,12)+[data]),
tonumber(left([row-1:Max],11)+Substring([row-1:Max],12,12)+[data]))
endif I used an iterative macro.
Dynamic Non-Macro Solution! Since I started quite late and had a strong feeling this was possible without a macro, I took my time and built this solution.
Happy Solving!
Initially, my solution generated way too many records.
I was initially unsure how to structure the logic for P2. However, once I understood it, the workflow proved to be less complex than I first thought.
- P1
The general idea was to select the largest digit from the right side of each position to create a two-digit number, and then select the largest among those.
- P2
The specific logic for P2 is as follows:
To determine the 1st digit (from the left):
To determine the 2nd digit:
To determine the 3rd digit:
This process is repeated in the same manner for the subsequent digits.
Finally, the 12 extracted digits are concatenated to form the resulting number, which completes the process.
<P1 Batch Macro>
<P2 Itterative Macro>
Started off part 1 by building an array. This would probably brute force part 2, but was taking too much time and laptop to finish.
Refactored into a more optimised solution that I could build into an iterative macro for part 2.
Day 3 done! I knew as soon as I started Part 1 that there'd be a Part 2 along those lines... but that didn't stop me getting a quick star before reevaluating my life decisions. Went down the macro route like most others for P2 - took a little while to figure out the logic and troubleshoot my filtering but got there in the end! A fun challenge!
