Excel Formula Challenge - Reduce function to Align Cities

Поділитися
Вставка
  • Опубліковано 18 гру 2024

КОМЕНТАРІ •

  • @willm7994
    @willm7994 Рік тому +2

    This is the best explanation of scan thank you ❤

    • @ExcelMoments
      @ExcelMoments  Рік тому

      You are welcome. And to think tat this was just me passing through the function to the final destination. I appreciate your feedback

  • @mohamedsoffar4434
    @mohamedsoffar4434 9 місяців тому +1

    It is too much helpful my dear thanks ,
    Now I can make iteration (loop function )and use where ever I want 😍
    =REDUCE(1,SEQUENCE(5),LAMBDA(s,T,SUM(s+1)))
    Like To repeat a range N times
    =DROP(REDUCE(1,SEQUENCE(10),LAMBDA(s,T,VSTACK(s,{1;2;3;4;5}))),1)

    • @ExcelMoments
      @ExcelMoments  9 місяців тому +1

      great. You have it all figured out 😁😁

  • @petercompton538
    @petercompton538 Рік тому +2

    This is brilliant. I tried too do it before watching your solution and could not, so thanks for a real education! The only area where I differ from you is that I prefer variables to have meaningful names such as "cities", "citylist","names", rather than a,b,c, and I would make the last calc a variable called result, so that my VSTACK would be simply VSTACK(citylist,result).
    Of course that takes nothing away from your wonderful explanation!

    • @ExcelMoments
      @ExcelMoments  Рік тому +1

      Thanks for your comments Peter. I really do appreciate it. I don;t think we differ in terms of what we think about descriptive names, it only appears so based on what I have demonstrated in the video. Descriptive names should make debugging easier too.

  • @quadriatharutech
    @quadriatharutech Рік тому +1

    This is the video I was talking about Mr. Victor. At first , I thought I understood it all. I guessed I should go through the video again to better understand it. Then, if my brain persist to take it in again. Then. I will reach out to you.

    • @ExcelMoments
      @ExcelMoments  Рік тому +1

      Alright, not a problem. It's not the easiest, neither is it the hardest, but let me know how it goes

  • @AlisonPollecutt
    @AlisonPollecutt 8 місяців тому +1

    I did not understand how REDUCE worked, from the explanations I'd seen. But now it makes sense! Thank you - pretty sure I will be watching this video several more times though!

    • @ExcelMoments
      @ExcelMoments  4 місяці тому

      Yea, multiple times demystifies the mystery

  • @carlseghers7822
    @carlseghers7822 8 місяців тому +1

    Great insights on how these functions work, thanks!
    Personally I would be inclined to first generate the cities in a spilled range:
    D1 =TOROW(UNIQUE(Table2[City]))
    Then, underneath, fill out the names with a second formula (the # in D1# making it dynamic):
    D2 =IFERROR(DROP(REDUCE("";D1#;LAMBDA(acc;city;HSTACK(acc;FILTER(Table2[Name];Table2[City]=city))));0;1);"")
    I think a bit simpler to understand but two formulas instead of one as in your case, so it's a bit of a tradeoff..

  • @ivanmamchych5802
    @ivanmamchych5802 Рік тому +1

    Thanks a lot , Victor!
    Very useful video lesson 👍

  • @nsanch0181
    @nsanch0181 Рік тому +1

    That was tough for me but very cool stuff. Thank you for the great video.

    • @ExcelMoments
      @ExcelMoments  Рік тому

      Definitely not the easiest of the Lot , but once the reduce function is understood , it becomes piece of cake

  • @stevereed5776
    @stevereed5776 Рік тому +1

    You have the ability to make these things sound very simple, thank you Victor

    • @ExcelMoments
      @ExcelMoments  Рік тому

      You are welcome and thanks for the compliment, I sincerely appreciate it

  • @nonoobott8602
    @nonoobott8602 Рік тому +1

    Great sturvs Victor. I'll be honest you opened my eyes to how these functions truly work. Thanks so much for sharing

  • @OzduSoleilDATA
    @OzduSoleilDATA Рік тому +2

    WILD!!!!!! 🤯

    • @ExcelMoments
      @ExcelMoments  Рік тому +1

      Not for kids!! but once you follow systematically, you will get it

  • @darkora_
    @darkora_ 7 місяців тому +1

    Thank you so much! This actually solved a problem I was having with a spreadsheet project and was very easy to follow along, it's also opened up a lot of options with other things I'm working on too =D

    • @ExcelMoments
      @ExcelMoments  7 місяців тому

      That's really good to know. Always excited when people can apply these concepts in their personal use cases

  • @sunnybaggu785
    @sunnybaggu785 Рік тому +2

    Thanks for the REDUCE function with HSTACK example. Greatful to you for the explanation. Was waiting for this video. Curiously waiting for your next video.

    • @ExcelMoments
      @ExcelMoments  Рік тому +1

      Thanks for your feedback. This is not one of the easiest challenges, but as always, we try to find away to solve it and share solution with the community. Looking forward to the next one too

    • @sunnybaggu785
      @sunnybaggu785 Рік тому +2

      @@ExcelMomentsmy excitement never stops for your upcoming updates ...

  • @TopBam
    @TopBam Рік тому +1

    Brilliant Mr. Momoh!

  • @jfjoyner3
    @jfjoyner3 Рік тому +1

    Very nicely explained!

  • @ziggle314
    @ziggle314 Рік тому +2

    I have a use for this example today! Thanks, Victor. Always insightful.

    • @ExcelMoments
      @ExcelMoments  Рік тому

      That's good to know. Sometimes it feels like just Excel challenges, but they do have real life applications

  • @IvanCortinas_ES
    @IvanCortinas_ES Рік тому +1

    The use of REDUCE with APILARH is impressive. Thank you Victor!!!

    • @ExcelMoments
      @ExcelMoments  Рік тому +1

      Thanks. I am not sure i know what APILARH is though, if you could help clarify

    • @IvanCortinas_ES
      @IvanCortinas_ES Рік тому +1

      @@ExcelMoments Sorry, I'm in Spain and here HSTACK is translated as APILARH.

    • @ExcelMoments
      @ExcelMoments  Рік тому +1

      @@IvanCortinas_ES It looked like something i had heard before but i couldn't place it. Yea, quite an interesting construct, hence the reason i shared it

  • @williamarthur4801
    @williamarthur4801 10 місяців тому +1

    I'm going to have to work through this a few times, at least, I get the filter and guessed the vstack for the final part. So thank you for making my head hurt.

  • @florincopaci6821
    @florincopaci6821 Рік тому +1

    Thank you for all the explanations from this video and not just from this one.

    • @ExcelMoments
      @ExcelMoments  Рік тому +1

      You ar welcome. Thank you for your feedback . Glad it helps

    • @florincopaci6821
      @florincopaci6821 Рік тому

      @@ExcelMoments I always like when someone explain and not just write a formula.It helps a lot.Thank you

    • @ExcelMoments
      @ExcelMoments  Рік тому +1

      @@florincopaci6821 Yea, If I were just writing it without explanations, there would be no point to a video. So the idea is to see my thought process and follow it sequentially to arrive at a solution

  • @michaelbrown8821
    @michaelbrown8821 Рік тому +2

    Excellent example. I was looking to do this very thing but was using MAP and not getting the results to filter into the correct columns. Thanks!

    • @ExcelMoments
      @ExcelMoments  Рік тому +1

      Hello Michael. Thanks for your feedback, MAP would struggle with this for sure. Once the dimensions of the resulting array are larger than the input array, then I don't think MAP. Input has 2 columns, Output needs 6 columns...NO MAP

  • @jazzista1967
    @jazzista1967 Рік тому

    Victor: this was a great demonstration on how to take advantage of the Lambda helper functions. I will download and practice several times to get the hang. Thanks, My friend!

    • @ExcelMoments
      @ExcelMoments  Рік тому

      That's how to get it. I promise to demonstrate something simpler in the next video, but in the interim, this should keep you busy 😀😀

    • @jazzista1967
      @jazzista1967 Рік тому +1

      Thats right.. Practice. Practice.. practice ... Did i say Practice? I really like how you go about explaining everything step by step . ... Victor... how long does it take you solve these types of challenges?

    • @ExcelMoments
      @ExcelMoments  Рік тому

      @@jazzista1967 If I have nothing else doing and I am able to focus on the problem solely, then I should have a solution in minutes (depending on the complexity). If it looks like something I have previously solved, then Yes, a few minutes to at least get a solution, then more minutes to make it more elegant, then hours thinking about how to dramatically reduce the length 😀😀😀😀

    • @jazzista1967
      @jazzista1967 Рік тому

      Man.. that would have been taking me a while. My naive approach would have been a transpose with unique and TOCOL...in one piece...for the headers... and for the guts of the table, i would have used the filter function. Today, i found a use to this challenge at work.... i will use your elegant solution!

  • @Fxingenieria
    @Fxingenieria Рік тому

    Thank you very much, your teachings are too valuable !!

    • @ExcelMoments
      @ExcelMoments  Рік тому

      I really do appreciate the feedback. Thank you

  • @Bhavik_Khatri
    @Bhavik_Khatri Рік тому +1

    Damn hard concept explained very well. Well done!!!

    • @ExcelMoments
      @ExcelMoments  Рік тому

      Thank you so much for the feedback. Very much appreciated

  • @vigneshwaran877
    @vigneshwaran877 Рік тому

    Great Explanation Victor! thanks .

    • @ExcelMoments
      @ExcelMoments  Рік тому

      Thank you so much for the feedback vignesh

  • @UtuDudas
    @UtuDudas 8 місяців тому

    Fantastic! I always wanted to make the filter work like that

    • @ExcelMoments
      @ExcelMoments  8 місяців тому

      I am glad I could demonstrate this use case

  • @ankursharma6157
    @ankursharma6157 4 місяці тому +1

    Thank You!

  • @FinexSkillsHub
    @FinexSkillsHub Рік тому +1

    Oga you do all!

    • @ExcelMoments
      @ExcelMoments  Рік тому

      Hahahhaa..Just trying to be like you sir 😀😀😀

  • @wayneedmondson1065
    @wayneedmondson1065 Рік тому +1

    Awesome, as always Victor! Thanks!!

    • @ExcelMoments
      @ExcelMoments  Рік тому +1

      Thanks Wayne, not one of the easiest ones, but good to mix it up sometimes 😀😀

  • @markpodesta4605
    @markpodesta4605 Рік тому

    Thank you Victor. Looks complicated to me.

    • @ExcelMoments
      @ExcelMoments  Рік тому +1

      Yea, it is not the easiest of the lot. Once you know how each of those functions work individually, fusing them together for a solution becomes easier.

  • @JoseAntonioMorato
    @JoseAntonioMorato Рік тому +6

    Dear Momoh,
    Your sorted formula:
    =LET(a,A2:A20,
    b,B2:B20,
    c,TOROW(SORT(UNIQUE(b))),
    VSTACK(c,DROP(REDUCE("",c,LAMBDA(x,y,IFNA(HSTACK(x,SORT(FILTER(a,b=y))),""))),,1)))
    Your formula sorted and with another alignment:
    =LET(a,A2:A20,
    b,B2:B20,
    c,SORT(UNIQUE(b)),
    VSTACK({"City","Names"},HSTACK(c,BYROW(c,LAMBDA(x,TEXTJOIN(", ",,SORT(FILTER(a,b=x))))))))
    Your formula sorted and with another alignment with separate columns:
    =LET(b,A2:A20,
    c,B2:B20,
    d,SORT(UNIQUE(c)),
    IFNA(VSTACK({"City","Names"},HSTACK(d,TEXTSPLIT(ARRAYTOTEXT(BYROW(d,LAMBDA(x,TEXTJOIN(", ",,SORT(FILTER(b,c=x)))))),", ",",",1,,""))),"")) 🤗

    • @ExcelMoments
      @ExcelMoments  Рік тому +2

      Great job. Excellent variations, built on the fundamental REDUCE construct

  • @martyc5674
    @martyc5674 Рік тому

    Great example of Reduce and very well explained. I have the perfect job for this tomorrow! But I think I will try it slightly differently, I’m thinking to use bycol to iterate through the unique cities using the filter function for the names- then stack the 2, I’ll let u know if it works!

    • @ExcelMoments
      @ExcelMoments  Рік тому

      Thanks Martin. It appears most people have at least a use case for it. Just to be clear, are you saying a BYCOL without a REDUCE?

    • @martyc5674
      @martyc5674 Рік тому

      @@ExcelMoments yes that’s my plan, use bycol on the cities array, passing each city into a filter returning the names. It’s worth a try- maybe I’ll just learn it won’t work 😂

    • @ExcelMoments
      @ExcelMoments  Рік тому +1

      @@martyc5674 Hahahahaha, I will be silent and and your feedback. One thing is certain, you will learn something 😀😀

    • @martyc5674
      @martyc5674 Рік тому +1

      @@ExcelMoments Ok-- so i tried, and it didnt work, byrow or bycol only return a single row or column i believe is the learning?? 😂😂

    • @ExcelMoments
      @ExcelMoments  Рік тому +2

      @@martyc5674 Now we are on the same page. So you realised that somewhere in the video I mentioned MAKEARRAY and REDUCE as the go to functions when you need a multi column multi row array. Ideally it should work but Excel does not currently support Array of Arrays (Nested Arrays), which is why it does not work

  • @centugurdag7776
    @centugurdag7776 5 місяців тому +1

    I do understand reduce function generally but not here