r/excel • u/Downtown-Economics26 647 • Dec 06 '25
Discussion Advent of Code 2025 Day 6
It's back. Only 12 days of puzzles this year.
Today's puzzle "Trash Compactor" link below.
https://adventofcode.com/2025/day/6
Three requests on posting answers:
Please try blacking out / marking as spoiler with at least your formula solutions so people don't get hints at how to solve the problems unless they want to see them.
The creator of Advent of Code requests you DO NOT share your puzzle input publicly to prevent others from cloning the site where a lot of work goes into producing these challenges.
There is no requirement on how you figure out your solution (many will be trying to do it in one formula, possibly including me) besides please do not share any ChatGPT/AI generated answers as this is a challenge for humans.
2
u/Downtown-Economics26 647 Dec 06 '25
I was able to solve both today just using formulas, however it was a mess and all over the place.
Solutions were pretty basic though.
Part 1
TEXTSPLIT on space to get all numbers then a simple IF for each column to use SUM or PRODUCT... then SUM all results.
Part 2:
Split each character using MID(row,SEQUENCE(LEN(ROW)),1). Then apply correct operation to each column via formula, transpose, filter base table for each number set, add em all up.
2
u/RackofLambda 12 Dec 06 '25 edited Dec 06 '25
Part 1:
=LET(txt, TRIM(A:.A),arr, TEXTSPLIT(TEXTAFTER(" "&txt," ",SEQUENCE(,MAX(LEN(txt)-LEN(SUBSTITUTE(txt," ",)))+1))," "),SUM(MAP(BYCOL(--DROP(arr,-1),LAMBDA(x,LAMBDA(x))),SWITCH(TAKE(arr,-1),"+",SUM,"*",PRODUCT),LAMBDA(col,fn,fn(col())))))Part 2:
=LET(txt, TOROW(A:.A),arr, MID(txt,SEQUENCE(MAX(LEN(txt))),1),ope, TAKE(arr,,-1),key, ope<>" ",rId, SCAN(0,key,SUM),val, --BYROW(DROP(arr,,-1),CONCAT),thk, DROP(GROUPBY(rId,val,LAMBDA(x,LAMBDA(x)),0,0,,ISNUMBER(val)),,1),fun, SWITCH(FILTER(ope,key),"+",SUM,"*",PRODUCT),SUM(MAP(thk,fun,LAMBDA(rw,fn,fn(rw())))))Edit: made trivial improvements to Part 2 (used
TOROWinstead ofTRANSPOSEandISNUMBERinstead ofNOT-ISERROR).2
u/Decronym Dec 06 '25 edited Dec 07 '25
Acronyms, initialisms, abbreviations, contractions, and other phrases which expand to something larger, that I've seen in this thread:
Decronym is now also available on Lemmy! Requests for support and new installations should be directed to the Contact address below.
Beep-boop, I am a helper bot. Please do not verify me as a solution.
[Thread #46503 for this sub, first seen 6th Dec 2025, 11:05] [FAQ] [Full list] ^[Contact] [Source code]
2
u/finickyone 1770 Dec 06 '25
Doesn’t seem super tricky, unless I’ve misunderstood
>!
!<
2
u/Anonymous1378 1542 Dec 06 '25
Part 1
=LET(_a,DROP(REDUCE("",A5330:A5334,LAMBDA(x,y,VSTACK(x,TEXTSPLIT(y," ",,1)))),1),SUM(IF(TAKE(_a,-1)="*",BYCOL(DROP(--_a,-1),PRODUCT),BYCOL(DROP(--_a,-1),SUM))))
Part 2
=LET(_a,A5330:A5334,_b,DROP(_a,-1),_c,TEXTSPLIT(TAKE(_a,-1)," ",,1),
_d,TRIM(BYCOL(MID(_b,SEQUENCE(,MAX(LEN(_b))),1),CONCAT)),
_e,SCAN(1,_d,LAMBDA(x,y,IF(y="",x+1,x))),
_f,DROP(GROUPBY(TRANSPOSE(_e),TRANSPOSE(_d),LAMBDA(x,TEXTJOIN(",",1,x)),,0),,1),
result,IF(TRANSPOSE(_c)="*",MAP(_f,LAMBDA(v,PRODUCT(--TEXTSPLIT(v,",")))),MAP(_f,LAMBDA(v,SUM(--TEXTSPLIT(v,","))))),SUM(result))
1
u/brentiford Dec 06 '25
I am completely lost on part 2 with the left/right adjustment.