Write Excel formulas like a programmer

  Рет қаралды 6,730

Diarmuid Early

Diarmuid Early

Күн бұрын

Пікірлер: 30
@Harryjackgross
@Harryjackgross Жыл бұрын
Great video as always - I didn’t realise until I tried it today that you can pass functions as arguments to lambdas - crazy!
@DimEarly
@DimEarly Жыл бұрын
The rabbit hole goes deep on this thing... if you're ready for the strong stuff, check out Jan-Karel Petersie's LAMBDA discussion group - there's whole sections of it I haven't even wrapped my head around yet, but definitely some interesting discussions!
@naiduvikas202
@naiduvikas202 Жыл бұрын
Who are you man ...? You are making stunning knowledge videos. Loving from India
@DimEarly
@DimEarly Жыл бұрын
Thanks - I'm glad you enjoy them!
@twalton
@twalton Жыл бұрын
This was amazing. Thank you!
@DimEarly
@DimEarly Жыл бұрын
Glad you liked it! : )
@RenierWessels
@RenierWessels Жыл бұрын
Amazing as always! Great video man.
@DimEarly
@DimEarly Жыл бұрын
Thanks Renier!
@nocturneuh
@nocturneuh 5 ай бұрын
Thanks 🙏
@ExcelWizard
@ExcelWizard Жыл бұрын
Absolutely amazing experience to see you build LAMBDA step by step, your thought is really organized and systematic. Fibonacci, You even cover small detail like if N is less than 3 choose t1 or t2. I would miss that as I just go like if N equal 2 then t2. Alternative REDUCE =--RIGHT(REDUCE(TEXTJOIN(" ",,G134:H134),SEQUENCE(J134-2),LAMBDA(a,v,TEXTAFTER(a," ")&" "&RIGHT(SUM(--TEXTSPLIT(a," ")),3))),3) Collatz Good thing to use ISOMITTED but if we don't put N by default N is blank and then blank +1 = 1 so this is my version I skip ISOMITTED. Collatz =LAMBDA(s, [n],IF(s = 1, n + 1, Collatz(IF(MOD(s, 2), s * 3 + 1, s / 2), n + 1))) and with SCAN =XMATCH(1,SCAN(G99,SEQUENCE(,999),LAMBDA(a,v,IF(MOD(a,2),a*3+1,ROUND(a/2,)))))+1 Level5 I nested everything in 1 LAMBDA SeqAvg = LAMBDA(ar,n,if(n,SeqAvg( ROUND((HSTACK(CHOOSECOLS(ar,2),DROP(ar,,-1))+HSTACK(DROP(ar,,1),CHOOSECOLS(ar,-2)))/2,) ,n-1) ,ar))
@DimEarly
@DimEarly Жыл бұрын
Very nice! I was just telling someone yesterday that SCAN, MAP, and REDUCE are top of my list of functions I want to learn to use properly - and I feel like I'm off to a good start just by studying your Collatz and Fibonacci functions. And good point about the omitted argument - I hadn't thought about the default value, but that makes it much simpler!
@ExcelWizard
@ExcelWizard Жыл бұрын
Thank you. I learn from you that the first point to create iterate LAMBDA is IF Exit. That makes it easier to write the LAMBDA. 😍😍 One more REDUCE to crack for Level5, have fun 😄 =INDEX(--TEXTSPLIT(REDUCE(TEXTJOIN(" ",,G171:Q171),SEQUENCE(S171),LAMBDA(t,n,LET(ar,TEXTSPLIT(t," "),TEXTJOIN(" ",,ROUND((HSTACK(CHOOSECOLS(ar,2),DROP(ar,,-1))+HSTACK(DROP(ar,,1),CHOOSECOLS(ar,-2)))/2,)))))," "),7)
@TA_ANTA
@TA_ANTA 6 ай бұрын
​@@DimEarly Hi guys, great video and alternative solutions discussed here. I'm still following along and learning so apologies in advance if this is a silly question but is there a decision tree logic that you guys apply to determine when to use a recursive lambda over using SCAN etc. like in the Collatz example? Or is it purely a matter of personal preference and whatever comes to mind first?
@Reduce_Scan
@Reduce_Scan Жыл бұрын
Fun topic , I would like a Clip on the same idea, but without using the defined name
@peachfreude
@peachfreude Жыл бұрын
That was enjoyable
@gsz2023
@gsz2023 Жыл бұрын
Thanks for the great video I learned a lot. Have you ever used DAX in excel?
@DimEarly
@DimEarly Жыл бұрын
Only very little - I use Power Query a lot, but Power Pivot not much. Glad to hear you found it helpful!
@Reduce_Scan
@Reduce_Scan Жыл бұрын
3:43 How many digits 7 are ... Second Bonus Question: 300 =LET(a,CONCAT(ROW(1:999)),b,LEN(a),SUM(--(MID(a,SEQUENCE(b),1)+0=7))) First Bonus Question: 35 =COUNT(VSTACK(1,SCAN(1,SEQUENCE(34,,2,0),LAMBDA(a,d,a*d))))
@DimEarly
@DimEarly Жыл бұрын
Nice formula for the 300! I'm not sure about the second one though - it looks like the logic is circular (i.e. it gives you 35 because your input sequence goes up to 35, but your sequence only goes to 35 because you already know that's the answer).
@Reduce_Scan
@Reduce_Scan Жыл бұрын
@@DimEarly Really, I would be grateful if you give me formula to solution
@DimEarly
@DimEarly Жыл бұрын
Sorry, I forgot I hadn't done the bonuses in the video (I usually do the whole question, but I was trying to be more 'thematic' on this one). If you're mathematically inclined, you can use =LOG(17179869184,2)+1, because LOG gives you the power you need to raise 2 to to get that number (and you add one because the sequence starts at 2^0=1, not at 2^1=2). If you wanted to do it more from first principles, you could use something like this: =XMATCH(17179869184,SCAN(1/2,SEQUENCE(50),LAMBDA(a,b,2*a))) The SCAN returns the sequence, and then you just match against that. You'd have to manually adjust the 50 argument if it wasn't big enough. Or, if you wanted to be a little cheeky, you could use the Collatz function I wrote in the case, because that basically steps through the same sequence in reverse (it's always even, so it always divides by 2), and counts the steps to get back to 1. So =Collatz(17179869184) would also return 35.
@Reduce_Scan
@Reduce_Scan Жыл бұрын
@@DimEarly Thanks for this much knowledge , very happy with LOG Function , Please I test the initial value with blank without space and got same result the Question How give me 1 in first range SCAN(,SEQUENCE(50),LAMBDA(a,b,2*a))
@Reduce_Scan
@Reduce_Scan Жыл бұрын
Level 4 Please test this Formula =RIGHT(DROP(REDUCE(Z20:AA20,SEQUENCE(AB20-2),LAMBDA(a,d,HSTACK(INDEX(a,,2),SUM(a)))),,1),3)+0
@DimEarly
@DimEarly Жыл бұрын
Nice! That works for the smaller examples, you'd need to tweak slightly for the ones with more terms, because once the numbers get above 15 digits, it won't keep full precision. If you use MOD to cut down to the last 3 numbers along the way, it works great: =RIGHT(DROP(REDUCE(H141:I141,SEQUENCE(K141-2),LAMBDA(a,d,HSTACK(INDEX(a,,2),MOD(SUM(a),1000)))),,1),3)+0
@TopBam
@TopBam 9 ай бұрын
I tried the Fibonacci formula with and without the mod(x+y,1000), but I'm not getting any different results. Am I missing something?
@DimEarly
@DimEarly 8 ай бұрын
I think you must be... if you just do the first few values they'll be the same, but they grow bigger than 1000 very quickly, and I think you'll hit Excel's limit on a number size (or at least its limit on the number of digits of accuracy it stores) well before you can get some of the answers if you don't use MOD to keep them smaller as you go along.
@TopBam
@TopBam 8 ай бұрын
@@DimEarly thanks, I fixed it! I just had to completely rewrite the formula. User error.
@DimEarly
@DimEarly 8 ай бұрын
@@TopBam Haha - happens to us all : )
@Reduce_Scan
@Reduce_Scan Жыл бұрын
Level 5 Please test this Formula =INDEX( REDUCE(B19:L19,SEQUENCE(O19),LAMBDA(u,i, LET(v,REDUCE(u,SEQUENCE(,10),LAMBDA(a,d, HSTACK(a,ROUND(SUM(INDEX(a,,d),INDEX(a,,d+2))/2,)))), g,DROP(DROP(DROP(v,,10),,-1),,1),HSTACK(INDEX(v,,2),g,INDEX(v,,10))))),7)
@DimEarly
@DimEarly Жыл бұрын
Nice! I haven’t had a chance to test it yet, but the logic looks good!
Battling a monster problem, with my first LAMBDA
50:05
Diarmuid Early
Рет қаралды 2,4 М.
Worst flight ever
00:55
Adam W
Рет қаралды 18 МЛН
Apple peeling hack @scottsreality
00:37
_vector_
Рет қаралды 128 МЛН
Пришёл к другу на ночёвку 😂
01:00
Cadrol&Fatich
Рет қаралды 10 МЛН
💩Поу и Поулина ☠️МОЧАТ 😖Хмурых Тварей?!
00:34
Ной Анимация
Рет қаралды 1,6 МЛН
When You Should Use the New Excel LET Function
17:18
Leila Gharani
Рет қаралды 763 М.
Excel challenge solution (and more!)
47:34
Diarmuid Early
Рет қаралды 1,3 М.
Excel LAMBDA - HOW & WHEN you Should use it
16:02
Leila Gharani
Рет қаралды 438 М.
Say Goodbye to IF Statements in Excel with SWITCH
7:45
Teacher's Tech
Рет қаралды 525 М.
How To Think Like A Programmer
1:00:07
Coding Tech
Рет қаралды 2 МЛН
Write your own Excel functions
19:22
Diarmuid Early
Рет қаралды 2,1 М.
5 Excel Tools Most Users Never Think to Use (Files Included)
12:34
MyOnlineTrainingHub
Рет қаралды 215 М.
I built my own 16-Bit CPU in Excel
15:45
Inkbox
Рет қаралды 1,4 МЛН
LAMBDA Function in Excel (CUSTOM Excel Formulas 😮)
13:59
Computergaga
Рет қаралды 2,9 М.
Excel Battle: CHOOSE vs SWITCH
11:00
Excel University
Рет қаралды 20 М.
Worst flight ever
00:55
Adam W
Рет қаралды 18 МЛН