STOP using nested IF statements! Use these functions instead.

แชร์
ฝัง
  • เผยแพร่เมื่อ 26 ก.ย. 2024

ความคิดเห็น • 38

  • @Excelambda
    @Excelambda 20 ชั่วโมงที่ผ่านมา +3

    Great Video !!
    SWITCH is "locked" to a single value and a single comparison op "="
    IFS can be a sequence of independent expressions that are checked for TRUE => any comparison operation, any formula or function that checks for TRUE ✌
    (There are tricks tho to use SWITCH as IFS ..=SWITCH(TRUE, )
    (Downside of IFS, we can not include an exit condition for a recursive function in IFS, will deliver #NUM error, should be good old regular IF formula)

    • @ExcelOffTheGrid
      @ExcelOffTheGrid  18 ชั่วโมงที่ผ่านมา +1

      That is very true. In that scenario, I would revert to the =SWITCH(TRUE,...) option.
      I didn't know about the recursive issue with IFS - that's quite a niche find. Good work.

  • @ennykraft
    @ennykraft 21 ชั่วโมงที่ผ่านมา +3

    For the sake of completeness, I would also give CHOOSE a mention. It wouldn't work with your example since it can't handle text but in some instances it's very handy. The other day I wanted a GROUPBY that will extract the month from a date and then sort them in the correct order. Since there will never be more values added, I used SWITCH.

    • @ExcelOffTheGrid
      @ExcelOffTheGrid  18 ชั่วโมงที่ผ่านมา +1

      Yes, CHOOSE is an option where numbers are involved. But I would probably still revert to SWITCH.

  • @B1897forzajuve
    @B1897forzajuve 11 ชั่วโมงที่ผ่านมา +2

    SWITCH with TRUE is one my favorite combos.

    • @ExcelOffTheGrid
      @ExcelOffTheGrid  10 ชั่วโมงที่ผ่านมา +1

      Mine too. 😁

  • @IvanCortinas_ES
    @IvanCortinas_ES 14 ชั่วโมงที่ผ่านมา +2

    SWITCH and IFS are 2 underrated functions and sometimes I would say even unknown to many users.
    Great explanation Mark.

    • @ExcelOffTheGrid
      @ExcelOffTheGrid  13 ชั่วโมงที่ผ่านมา +1

      Thanks Ivan - when IF is so will known, most people won't look for alternative solutions.

  • @aliab2201
    @aliab2201 17 ชั่วโมงที่ผ่านมา +1

    Big thanks Mark! looking forward for the next informative video.

  • @erikguzik8204
    @erikguzik8204 8 ชั่วโมงที่ผ่านมา +1

    for those of us that learned spread sheet (pre MS Office) - in Visi-Calc, we didn't have the IF function, we had the lookup function to use. So many people want to assign letter grades you know the old scale 90-100 = A. 80-89 = B..... and so on, the lookup function is perfect for this scenario. Nested IF functions are a mess and really should be avoided. too hard to troubleshoot. Great Video again.

  • @Rice0987
    @Rice0987 15 ชั่วโมงที่ผ่านมา +1

    That parentheses at the end of multiple IF looks like wide smile :))))))))

    • @ExcelOffTheGrid
      @ExcelOffTheGrid  13 ชั่วโมงที่ผ่านมา +1

      At least that is one positive.
      Or it could be 1 smile, a chin and 8 double chins 😁

  • @ledow119
    @ledow119 22 ชั่วโมงที่ผ่านมา +1

    Im wondering if you accept paid excel solutions requests

    • @ExcelOffTheGrid
      @ExcelOffTheGrid  18 ชั่วโมงที่ผ่านมา

      Thanks for asking. Not at present; we've got a long course and consultancy backlog, so we're not taking anything else on at the moment.

  • @joselencinamalgor6548
    @joselencinamalgor6548 10 ชั่วโมงที่ผ่านมา +1

    Great Xlookup solution. Thanks.!!!😄 Why I didnt think!!, but if you have range values to select de % which recommend? (100 - 200) 10%

    • @ExcelOffTheGrid
      @ExcelOffTheGrid  10 ชั่วโมงที่ผ่านมา +1

      XLOOKUP can handle range lookups - so that’s achievable.

  • @RichardJones73
    @RichardJones73 16 ชั่วโมงที่ผ่านมา +1

    Can you do one for power query? Why it didn't use switch already is baffling to me, especially as it's in power bi?

    • @ExcelOffTheGrid
      @ExcelOffTheGrid  13 ชั่วโมงที่ผ่านมา

      Power Query is tricky as there is no SWITCH function... but there are some interesting options. Maybe I should do a video - good idea.

  • @吳百正
    @吳百正 16 ชั่วโมงที่ผ่านมา +1

    I would use the LOOKUP function.

    • @ExcelOffTheGrid
      @ExcelOffTheGrid  15 ชั่วโมงที่ผ่านมา

      LOOKUP requires the list to be in ascending order, so would make me feel a little nervous that I might make an error.

  • @stanTrX
    @stanTrX 17 ชั่วโมงที่ผ่านมา +1

    ❤❤❤

  • @maciejkaron7479
    @maciejkaron7479 21 ชั่วโมงที่ผ่านมา +1

    Thank you! Is it possible to use LEFT function with XLookup as a Lookup Value? I want to retreive only 5 digits not a whole sentence.

    • @ennykraft
      @ennykraft 21 ชั่วโมงที่ผ่านมา +2

      Yes. Your lookup value can be a formula. Just make sure that the kind of values you look for are are the same type. LEFT results in a text. If the lookup table has stored them as numbers you will get an #VALUE? error message. What you would need in this case is XLOOKUP(LEFT(A,5)+0,lookup column, return column). +0 (or *1) will convert the result into a number. You could also use the VALUE function.

    • @ExcelOffTheGrid
      @ExcelOffTheGrid  18 ชั่วโมงที่ผ่านมา

      Thanks for answering. Good thought about numbers vs text - I probably would have forgotten that.

  • @kebincui
    @kebincui 20 ชั่วโมงที่ผ่านมา +1

    Brilliant❤,thanks Mark

    • @ExcelOffTheGrid
      @ExcelOffTheGrid  18 ชั่วโมงที่ผ่านมา

      Glad you enjoyed it - Thanks Kebin.

  • @gonzuic
    @gonzuic 19 ชั่วโมงที่ผ่านมา +1

    Hi Mark, thank you for sharing this information…
    Talking about performance, which scenario do you recommend?
    Gracias, saludos.

    • @ExcelOffTheGrid
      @ExcelOffTheGrid  18 ชั่วโมงที่ผ่านมา +1

      For performance, I don't have a bit preference either way. If it became an issue, I would try them all and see if it makes any significant difference.

    • @HowToExcelBlog
      @HowToExcelBlog 15 ชั่วโมงที่ผ่านมา

      @@ExcelOffTheGrid Unfortunately, IFS and SWITCH calculate ALL the conditions/results whereas IF stops calculating after the first TRUE. I discovered this while trying to figure out why my recursive LAMBDA was working with IF but not with IFS.

    • @HowToExcelBlog
      @HowToExcelBlog 15 ชั่วโมงที่ผ่านมา

      CHOOSE is also efficient like IF, it only calculates the item chosen

  • @chrism9037
    @chrism9037 20 ชั่วโมงที่ผ่านมา +1

    Nice video Mark!

    • @ExcelOffTheGrid
      @ExcelOffTheGrid  18 ชั่วโมงที่ผ่านมา

      Thanks! Glad you enjoyed it. 😁

  • @chiragdabhi4929
    @chiragdabhi4929 2 ชั่วโมงที่ผ่านมา

    Pls make video xlookup between ranges ...-20 to -10 ; -10 to 0; 0 to 10 ;10 to 20; > 20 like that

  • @SimplyDigitalLK
    @SimplyDigitalLK 2 ชั่วโมงที่ผ่านมา

    Very good video. And very nice topic to discuss!! A lot of people use if and spend hours to do complicated nested IF fuctions, while really - there are just simple solutions. For me, im basicaly nesting one IF as maximum. And thats mostly for cells that are not part of any table. So i only need result once. In any other case, the lookop table solution is for sure more flexible and easier to do. + You can do xlookap for smaller / higher values too which is one of the greatest options there !!

  • @leerv.
    @leerv. 7 ชั่วโมงที่ผ่านมา

    The third option is smart. I guess I keep commenting about data theory on your videos, Mark, but I think a good lesson to remember is that there is no rule that says you have to accomplish everything in one table, especially not if it means you have a formula filled with magic numbers!

  • @lpanades
    @lpanades 4 ชั่วโมงที่ผ่านมา

    Make all sense!

  • @Quidisi
    @Quidisi 13 ชั่วโมงที่ผ่านมา

    My gripe with IFS is that it evaluates the entire formula, even if the first argument returns TRUE - whereas nested IF statements will stop evaluating as soon as TRUE is encountered.
    No big deal on most spreadsheets , but can really eat up CPUs on huge sheets with complex logical formulas.
    My experience, IF is less CPU intensive, and quicker. Thus I've stopped using IFS :(

    • @ExcelOffTheGrid
      @ExcelOffTheGrid  13 ชั่วโมงที่ผ่านมา

      That's interesting - I've never had spreadsheets so big that I've noticed a significant impact.
      My first thought is why have you got so many IF functions, sounds like data shaping before loading into Excel might help speed things up.