Это видео недоступно.
Сожалеем об этом.

How to Sum Cells by Color in Excel (Get it to update automatically)

Поделиться
HTML-код
  • Опубликовано: 14 авг 2024
  • Join 400,000+ professionals in our courses here 👉 link.xelplus.c...
    Learn how to write an Excel formula to sum values based on the cell background color.
    ⬇️Download the workbook here: pages.xelplus....
    We achieve this with a simple Excel VBA function. The VBA function has two arguments. One is for color and the other the range that needs to be summed. You can use a similar technique to count cells based on color.
    We also improve on the VBA code to have the formula results update automatically when a cell color in the range changes. This is done by using the worksheet selection change event for a specific range. We achieve this with the Application.Intersect method.
    🔍 What You'll Learn:
    - Crafting a custom VBA function for summing values by cell color.
    - Simplified approach to VBA programming with hands-on examples.
    - How to implement dynamic cell color selection in your custom function.
    🛠️ Custom Function Features:
    - Ability to sum values based on specified cell background color.
    - Two argument implementation: target cell color and range for summing.
    - Step-by-step guide to creating and integrating the function in Excel.
    💡 Key Takeaways:
    - Enhance your Excel projects with dynamic, color-based calculations.
    - Gain practical knowledge in VBA, making your data analysis more efficient.
    - Discover how to tailor Excel functions to your specific needs.
    LINK to Excel VBA Playlist: • Excel VBA & Macros Tut...
    ➡️ Join this channel to get access to perks: / @leilagharani
    👕☕ Get the Official XelPlus MERCH: xelplus.creato...
    🎓 Not sure which of my Excel courses fits best for you? Take the quiz: www.xelplus.co...
    🎥 RESOURCES I recommend: www.xelplus.co...
    🚩Let’s connect on social:
    Instagram: / lgharani
    LinkedIn: / xelplus
    Note: This description contains affiliate links, which means at no additional cost to you, we will receive a small commission if you make a purchase using the links. This helps support the channel and allows us to continue to make videos like this. Thank you for your support!
    #excel #ExcelVBA

Комментарии • 554

  • @LeilaGharani
    @LeilaGharani  6 месяцев назад +2

    Grab the file I used in the video from here 👉 pages.xelplus.com/sum-color-file

  • @christineschwartz7185
    @christineschwartz7185 13 дней назад

    Great Video!!! This is what I've been searching for everywhere.

  • @torkunc
    @torkunc 5 лет назад +1

    it is just not what you teach, it is also how you present the knowledge to in front of us.
    I admire your way of teaching.
    I am only at 16% progress of your online course and already feel that finally I am getting the concept and structure of the Vba.
    thnx for everyrhing.

    • @LeilaGharani
      @LeilaGharani  5 лет назад +1

      Thanks for the kind words. That's good progress on VBA! The beginning is the hardest part.

  • @ficoalvarez
    @ficoalvarez Месяц назад

    Great lessons! Thank you!

  • @mseker66
    @mseker66 3 года назад +5

    Best vid ever in this subject. I appreciate you for sharing this. Merci Leila :)

  • @ckokse
    @ckokse 5 лет назад +1

    You are making VBA understandable even for me. That's some gift!

  • @sarfarajkureshi6569
    @sarfarajkureshi6569 5 лет назад +1

    Mam in every video you share miracle tricks, which not got on you tube. Love you mam...

    • @LeilaGharani
      @LeilaGharani  5 лет назад +1

      I'm happy to hear that the videos are useful.

  • @loganathankannan1989
    @loganathankannan1989 5 лет назад

    your way of explanation makes me to get in to excel and learn more and more. Last two years i have been continuously using various ideas from this site. Thanks a lot.

    • @LeilaGharani
      @LeilaGharani  5 лет назад

      You're most welcome. Thank you for your ongoing support.

  • @NiranjanS9916
    @NiranjanS9916 5 лет назад

    Wow....!! I have been using excel since 1997 but I wasn't aware of these fantastic function.
    You are just brilliant.
    I subscribe already....
    I Love You...Mam. I am impressed so much.
    Many Many Thanks for sharing.......

    • @LeilaGharani
      @LeilaGharani  5 лет назад

      You're very welcome. Glad you found something new.

  • @dadgau
    @dadgau 5 лет назад +1

    As great as usual. Leila you are Queen of Excel.
    Thank you so much for this tutorial.
    Kind regards

    • @LeilaGharani
      @LeilaGharani  5 лет назад +1

      My pleasure. Glad you like the video.

  • @Victor-ol1lo
    @Victor-ol1lo 5 лет назад +1

    Great video Leila !! Thanks for sharing !! Ctr+Shift+A is a very helpful shortcut do display the fuction arguments quickly.....

    • @LeilaGharani
      @LeilaGharani  5 лет назад

      You're very welcome Victor. Glad you like the video.

  • @vikascma
    @vikascma 4 года назад +2

    You are my Excel Guru...🙂 Thanks!

    • @vikascma
      @vikascma 4 года назад

      🙂🙂🙂

  • @dmarquez304
    @dmarquez304 8 дней назад

    Thank you SO MUCH 🙏🏼

  • @MeatRocket72
    @MeatRocket72 3 года назад

    Flawless and thorough example of something that's been driving me nuts! Thank you so much!

  • @bestscenes1469
    @bestscenes1469 5 лет назад

    I have been using sum base on color for sometime but you have added something new. Thanks a million.

  • @shabbirkanchwala-abwaab6263
    @shabbirkanchwala-abwaab6263 5 лет назад

    An absolutely new aspect of Excel
    Never had an idea for any such possibility in Excel
    I am very much impressed
    Thank you

    • @LeilaGharani
      @LeilaGharani  5 лет назад +1

      You're very welcome. That's the beauty of Excel. A lot of possibilities.

    • @shabbirkanchwala-abwaab6263
      @shabbirkanchwala-abwaab6263 5 лет назад

      @@@LeilaGharani
      How to know where to use Vlookup, Index/Match/Dget?
      Pls Help

    • @LeilaGharani
      @LeilaGharani  5 лет назад

      That's easy: always Index & Match :)

  • @batarasiagian9635
    @batarasiagian9635 5 лет назад

    I didn't even know this was possible despite using Excel for a long time. Many thanks. :)

    • @LeilaGharani
      @LeilaGharani  5 лет назад +1

      I'm glad you found something new.

  • @anilmudakannavar79
    @anilmudakannavar79 5 лет назад

    Once again came with great work, u have made many of us rich & richer knowledge-wise. Just waiting for the next one very soon

    • @LeilaGharani
      @LeilaGharani  5 лет назад

      I'm happy the tutorial is helpful for you.

  • @robertakwasiadjei8223
    @robertakwasiadjei8223 5 лет назад +1

    Thanks once again Leila. May the good Lord richly bless

  • @JG-ql3nw
    @JG-ql3nw 2 года назад

    Great value, finally I understand fantastic metod, I'm using Excel in spanish and it worked perfectly. Like for sure 👍🏼

  • @maheshlowe907
    @maheshlowe907 3 года назад

    Thanks very helpful video.

  • @seyrankerimli6713
    @seyrankerimli6713 2 года назад

    Thank you for your efforts it's the best and very helpfull lesson.

  • @karenwilcox1995
    @karenwilcox1995 4 года назад

    Fabulous tutorial - Thank You. I'm not sure I totally understood the VBA (just bits of it), but I followed your instructions and my spreadsheet works perfectly. So chuffed.

  • @xlschool7334
    @xlschool7334 5 лет назад

    thanks again Leila for your best tutorials.

  • @gabrieldry1905
    @gabrieldry1905 3 года назад

    Thanks so much for the easy-to-follow, professional video! Works like a dream on my Macbook. :)

  • @irfanmansoori3060
    @irfanmansoori3060 4 года назад

    Dear Leila.. the kind of knowledge and the skills you have to spread that knowledge is simply awesome.. thanks for all your knowledge sharing.. im a big fan of yours.. sincerely..

  • @sandeepgupta9498
    @sandeepgupta9498 5 лет назад

    One of the best tutor ever

  • @khazza930
    @khazza930 4 года назад

    super helpful this video. I had no idea how to create a custom function... also all these little details getting the active cell and a cell's colour.
    thanks muchly :)

  • @jjb110
    @jjb110 5 лет назад +1

    Hello Leila, I'm a new subscriber!! Thank you for the content you put out! You are super AWESOME!!!!

    • @LeilaGharani
      @LeilaGharani  5 лет назад +1

      Great to have you here José. I'm glad you like the content.

  • @ExcelExciting
    @ExcelExciting 5 лет назад

    Superb..!!! I feel Excel Team should bring this function permanently in workbook. Thanks for sharing solution..!!

    • @LeilaGharani
      @LeilaGharani  5 лет назад

      You're very welcome. Glad you like it.

  • @jonathanbelliot509
    @jonathanbelliot509 4 года назад

    Thanks you so much. This is what i needed for a company project. Very clear and very useful! Considering following the VBA course now!

    • @LeilaGharani
      @LeilaGharani  4 года назад

      Great to hear! I hope you'll like the course.

  • @esmailiyou
    @esmailiyou 4 года назад

    Awesome video, competent and fast. Thx a lot!

  • @amilcarc.dasilva5665
    @amilcarc.dasilva5665 5 лет назад

    Huge thanks Leila. Your video tutorial is great and very informative and helpful. Thanks a lot.

    • @LeilaGharani
      @LeilaGharani  5 лет назад +1

      You're very welcome Amilcar. Glad you like the video.

    • @amilcarc.dasilva5665
      @amilcarc.dasilva5665 5 лет назад

      @@LeilaGharani Yeah. You've done great work by sharing your expertise. Really appreciate. Keep it up.

  • @maciekmatula5488
    @maciekmatula5488 4 года назад

    If i could like this twice I would. So brilliant and straightforward! Thank you!

    • @LeilaGharani
      @LeilaGharani  4 года назад

      My pleasure. Thanks for the Like!

  • @flspeid
    @flspeid 2 года назад

    Great video!!

  • @askulasaatwik8thc644
    @askulasaatwik8thc644 5 лет назад

    Thank you Leila for letting us know about a new thing today.

    • @LeilaGharani
      @LeilaGharani  5 лет назад +1

      You're very welcome. Glad it is helpful.

  • @adrianmanzat879
    @adrianmanzat879 4 года назад +6

    Hi Leila,
    Your tutorials are great . The script does not seem to work with conditional formatting colors. Do you have any idea how we can fixed that? If you can help us on this , you'll be a life saver.
    Thank you .

  • @user-me5vg5rq4o
    @user-me5vg5rq4o Год назад

    Good Laxcering, Vary Usfoul., Thank you.

  • @enriquedominguez9709
    @enriquedominguez9709 5 лет назад

    Thank you Leila. Excellent as allways.

    • @LeilaGharani
      @LeilaGharani  5 лет назад

      You're very welcome Enrique. Glad you like it.

  • @jayaseelanthimman3512
    @jayaseelanthimman3512 3 года назад

    Excellent, Very useful. Thanks.

  • @arditi2288
    @arditi2288 9 месяцев назад

    Super erklärt!
    Vielen Dank!

  • @Dogger1230
    @Dogger1230 5 лет назад

    You truly are the excel goddess!!!

  • @guntisdlohi8453
    @guntisdlohi8453 2 года назад

    Thank you. This was amazingly useful. Simple tool to make and edit preliminary Gantt charts.

  • @Patrick-ge2zn
    @Patrick-ge2zn 3 года назад

    Thank you ,this is just what I was looking for .

  • @muhammadrashid3307
    @muhammadrashid3307 5 месяцев назад

    Hello Leila! am Rashid from Pakistan and these days i am practicing vba excel and i enrolled in your vba course on Udemy approx. one and half month ago

  • @VipulKarkar
    @VipulKarkar 5 лет назад +1

    Fantastic video: I think, assigning color to variable and than checking will have some overhead if multiple cells have this function.
    I would go with directly adding it under if condition because checking Boolean is faster than 2 step process of assigning than checking it.
    If cell.interior.color = matchColor.interior.color then....
    will be faster.
    Thank you for your time Leila.

  • @dkb1111
    @dkb1111 5 лет назад

    No one like you, you are great

  • @adnankhalil2
    @adnankhalil2 3 года назад

    Really helpful, Thanks

  • @maybinmumba5288
    @maybinmumba5288 3 года назад

    This is extremely helpful! Thanks Leila!

  • @AweshBhornya-ExcelforNewbies
    @AweshBhornya-ExcelforNewbies 5 лет назад

    Thanks a lot Leila the video and trick was awesome you are a great teacher. Even though I am Lecturer myself I find your training and videos amazing. Thanks a lot.

    • @LeilaGharani
      @LeilaGharani  5 лет назад

      Thanks for the kind words. I'm glad you like the video.

  • @macleb
    @macleb 4 года назад

    thank you so much for taking part of your time to help other, may you find reward in this life and the next!!!
    you are brilliant

    • @LeilaGharani
      @LeilaGharani  4 года назад +1

      You're very welcome. As long as it's helpful I am happy :)

  • @jayaliciousmusic
    @jayaliciousmusic 3 года назад

    Thank you Leila, That was amazing and easy to understand. Very helpful

  • @supersonicbasugmail
    @supersonicbasugmail 3 года назад

    Thank for this Leila!

  • @atkentravelafrica4361
    @atkentravelafrica4361 3 года назад

    This was very helpfully in calculate my everyday Transactions Records working as wakala in Tz. So happy i found this.

  • @faridanwar8536
    @faridanwar8536 4 года назад

    thanks very use full

  • @Regimeshifts
    @Regimeshifts 5 лет назад

    Came here for Excel and loved the video as I do your other videos. Comments are weird though

  • @EnkhturDamdinjav
    @EnkhturDamdinjav 3 года назад

    it seems to be very useful even when dealing with a data matrix containing data where I want to show sum of values in different colored cells for each row... can't wait to check this out, have to clean my data first

  • @wolfgang2149
    @wolfgang2149 2 года назад

    I love it great Tuto thanks a lot Leila

  • @shihyeanheng6502
    @shihyeanheng6502 4 года назад

    Very useful, thanks for sharing

  • @huytangquoc5682
    @huytangquoc5682 5 лет назад +1

    Thank you, this is what i have been looking for a long time. It is really helpful. Big Thank

    • @LeilaGharani
      @LeilaGharani  5 лет назад

      You're very welcome. I'm glad the video is useful.

  • @kingmaya
    @kingmaya 5 лет назад

    I have checked some of your tutorials ...Amazing!!!

  • @manfas1
    @manfas1 4 года назад

    Thank you very much

  • @abk_asrjc
    @abk_asrjc 4 месяца назад

    Hi Leila. Thank you for the video. I've done the selection update as per your tutorial. The numbers are still not updated. I've changed your VBA slightly to count instead of sum by the way.

  • @Dirtyboxer1
    @Dirtyboxer1 5 лет назад

    I was struggling to do this very thing last week. Thank you.

    • @LeilaGharani
      @LeilaGharani  5 лет назад

      You're very welcome Michael. Glad I could help with that.

  • @peternganga9371
    @peternganga9371 5 лет назад

    Thanks Leila. Seems like I got to learn VBA for custom needs.

    • @LeilaGharani
      @LeilaGharani  5 лет назад +1

      It can really be helpful Peter.

    • @peternganga9371
      @peternganga9371 5 лет назад

      @@LeilaGharani so I thought. Thank you as always. God grant you abundant energy to do the beautiful work you do here (online). I must say that I am your loyal student and has in return referred quite a number who feels the same. I have been a teacher and so can tell of a good one. You are one of the best. Thanks once again and God bless.

  • @michaelpan1736
    @michaelpan1736 4 года назад

    You are an expert! 👍

  • @yugpursh
    @yugpursh 2 года назад

    Seems very precise and easy, of-course very well explained but had no luck still; getting error in the function.

  • @junnelduluguin5324
    @junnelduluguin5324 5 месяцев назад

    Hi Leila, I'm one of your video subscribers, please, I would like to request that you create me an IF or conditional formatting formula to color only one cell that has a total value. Thanks.

  • @larayoudell-gallman3094
    @larayoudell-gallman3094 4 года назад +6

    Great tutorial. Everything works fine. Having trouble with the formula automatically updating. I set it up following the instructions and everything works. If I save the document excel stops automatically updating the formula if I make any changes. I have to manually force the cell to update. Has anyone else experienced this if know how I fix this problem?

    • @alextones8010
      @alextones8010 3 года назад

      I am have the same problem does any one know how to fix this

    • @mvohra
      @mvohra 3 года назад +1

      I had the same issue, found this on Google and it worked for me. Just added 2 lines to Leila's code.
      Private Sub Worksheet_SelectionChange(ByVal Target As Range)
      If Not Intersect(Target, Range("A:C")) Is Nothing Then
      ActiveSheet.Calculate
      ActiveSheet.EnableCalculation = False
      ActiveSheet.EnableCalculation = True
      End If
      End Sub

    • @RNTwan
      @RNTwan 2 года назад

      @@mvohra Thank you for the help. It works

    • @ThiagoPikcius
      @ThiagoPikcius 2 года назад

      @@mvohra OMG, thank you so much

  • @dennisd5776
    @dennisd5776 5 лет назад

    Another great video tip. Thank you.

    • @LeilaGharani
      @LeilaGharani  5 лет назад

      You're very welcome Dennis. Glad you like the video.

  • @LooKGaming2030
    @LooKGaming2030 5 лет назад

    Very nice.
    We need VBA lessons.

  • @19mrmrm87
    @19mrmrm87 3 года назад

    This video is amazing! thank you so much!!! I needed this so much to make my budgets better :) thank you!!!!

  • @funnytime1111
    @funnytime1111 4 года назад

    Wow thank you, idk anything about VBA but I was able to follow along easily. You are amazing

  • @yulinliu850
    @yulinliu850 5 лет назад

    Excellent as always!

  • @huseyinallito3454
    @huseyinallito3454 5 лет назад

    Truly appreciate your work. Thank you very much

    • @LeilaGharani
      @LeilaGharani  5 лет назад +1

      You're very welcome. Glad you find the videos helpful.

  • @17aig
    @17aig 5 лет назад

    Thanks again for a great presentation as usual

    • @LeilaGharani
      @LeilaGharani  5 лет назад

      You're very welcome. Glad you like it Nissim.

  • @tica5791
    @tica5791 5 лет назад

    Superb! The Queen of excel really.

  • @ronvds4713
    @ronvds4713 5 лет назад

    Great presentation on a function I thought was not possible, but having trouble thinking where this would be useful.

    • @LeilaGharani
      @LeilaGharani  5 лет назад

      Maybe at some point it will come in handy. It's always good to know what is possible.

  • @preetiyadav5513
    @preetiyadav5513 2 года назад

    Thank you 😊

  • @wayneedmondson1065
    @wayneedmondson1065 5 лет назад

    Hi Leila.. love that If Not Intersect() Is Nothing construct. Before understanding that concept, I used the overkill method of ActiveSheet.Calculate on the full Worksheet_SelectionChange event.. which made some of my workbooks very slow. Now, they are much speedier and more efficient. Thanks for the great videos, lessons and insights.. always something fun, new and interesting on your channel and web site. Thumbs up!!

    • @LeilaGharani
      @LeilaGharani  5 лет назад +1

      Thank you for the kind words and the thumbs up Wayne!

  • @heikoheimrath7514
    @heikoheimrath7514 5 лет назад

    Great stuff Leila 👏

  • @chanduhandsome9316
    @chanduhandsome9316 5 лет назад

    Thanks Leila, this was a helpful video

    • @LeilaGharani
      @LeilaGharani  5 лет назад

      You're welcome. I'm glad you like the video.

  • @julienbouillot6960
    @julienbouillot6960 5 лет назад

    I have become a huge fan on how you help us and better ways to organise and visualise our data. Unfortunately while this is great when dealing with smaller ranges of data, excel 's performance is really letting me down when it comes down to dealing a large number of rows and references across multiple sheets. Any tip on how to boost the performance in corporate license environment would really help make the most out your tutorials! Great channel! Keep it up.

    • @LeilaGharani
      @LeilaGharani  5 лет назад

      You could check out this infographic: www.xelplus.com/speed-up-your-excel-files/

  • @arjunavayalombrone243
    @arjunavayalombrone243 3 года назад

    Wow. This was amazing thanks!!!

  • @jess-yp7lz
    @jess-yp7lz 3 года назад

    I tried this and it's working. Thank you very much. T.T

  • @MrBrianb1066
    @MrBrianb1066 3 года назад +5

    This is excellent, but is it possible to count instead of sum? Also, can it be set up to count conditionally formatted color? Any help is appreciated! Thanks!

    • @magskl672
      @magskl672 6 месяцев назад

      this is what I did for counting yellow cells.
      Function CountColor(countRange As Range) As Double
      Dim cell As Range
      For Each cell In countRange
      If cell.Interior.Color = 65535 Then
      CountColor = CountColor + 1
      End If
      Next cell
      End Function

  • @jamilhfl
    @jamilhfl 4 года назад

    Excellent

  • @alsaudi101
    @alsaudi101 5 лет назад

    Thank you . You are super

  • @mostafa4321
    @mostafa4321 5 лет назад

    Excellent again Leila

  • @ganeshbhamare7
    @ganeshbhamare7 5 лет назад

    Thanks Leila, you really made it for my requirements.
    Thanks Again.

  • @maxpayne6919
    @maxpayne6919 5 лет назад

    Leila thank you! Dream woman right there

  • @anuraagdaga
    @anuraagdaga 4 года назад +2

    I have a range of cells which are conditional formatted with different colors. This doesnt work for that. While summing up in the "Fx" function, the empty cells are treated as " " instead of 0 and hence the overall sum function fails. How can this be handled, please?

  • @indycaptain69
    @indycaptain69 4 года назад +5

    Hello, great video. Can you advise how to modify the code if you want the count of color cells (conditionally formatted - upto 5 CF rules ) only and not the sum of cell contents?

  • @Ya-ot5zl
    @Ya-ot5zl 3 года назад

    thank you so much!!!!

  • @katerina6495
    @katerina6495 5 лет назад

    Thank you Leila, this is super cool, have a great day
    🤗

    • @LeilaGharani
      @LeilaGharani  5 лет назад +1

      You're very welcome Katerina. Liebe Gruesse :)

  • @nasirathadjibade8738
    @nasirathadjibade8738 3 года назад +2

    Thank you! That was so easy to follow. When I save the excel document it no longer automatically updates the sum if I change a color. What can I do?

    • @WiSaAngel1939
      @WiSaAngel1939 3 года назад +1

      I face that problem too, did you know how to fix it?

    • @mvohra
      @mvohra 3 года назад +1

      I had the same issue, found this on Google and it worked for me. Just added 2 lines to Leila's code.
      Private Sub Worksheet_SelectionChange(ByVal Target As Range)
      If Not Intersect(Target, Range("A:C")) Is Nothing Then
      ActiveSheet.Calculate
      ActiveSheet.EnableCalculation = False
      ActiveSheet.EnableCalculation = True
      End If
      End Sub

  • @darlavishu
    @darlavishu 5 лет назад

    Hi Leila, I truly appreciate your work, I keep watching your videos as they are extremely informative and I keep learning new techniques in excel. I see this video has some VBA at a medium level. I wanted to learn VBA from a more beginner level and request you to advise me on where to start ..

    • @LeilaGharani
      @LeilaGharani  5 лет назад

      I have a VBA course that will take you from beginner to advanced. If you are interested you can check it out here: courses.xelplus.com/p/excel-vba-excel-macros

  • @stephenbrincat7124
    @stephenbrincat7124 5 лет назад

    Wow, looks great. That will be my next course after the I finish the excel course from yours.

    • @LeilaGharani
      @LeilaGharani  5 лет назад

      That's great Stephen. Looking forward to seeing you there.

  • @syedikramullah1114
    @syedikramullah1114 5 лет назад

    Excellent mam

  • @justinking5958
    @justinking5958 4 года назад

    Fantastic!! Thank you so much!