Тёмный

Count by Cell Colour - Excel VBA Function 

Computergaga
Подписаться 106 тыс.
Просмотров 26 тыс.
50% 1

Excel does not have a function to count by cell colour, so this video tutorial shows how to create a custom function to count by cell colour.
Get the code here - www.computergaga.com/blog/cou...
The video walks you through the different parts of the code and then demonstrates it working on a spreadsheet.
Find more great free tutorials at;
www.computergaga.com
** Online Excel Courses **
The Ultimate Excel Course - Learn Everything ► bit.ly/UltimateExcel
Excel VBA for Beginners ► bit.ly/37XSKfZ
Advanced Excel Tricks ► bit.ly/3CGCm3M
Excel Formulas Made Easy ► bit.ly/2ujtOAN
Creating Sports League Tables and Tournaments in Excel ► bit.ly/2Siivkm
Connect with us!
LinkedIn ► / 18737946
Instagram ► / computergaga1
Twitter ► / computergaga1

Хобби

Опубликовано:

 

22 авг 2016

Поделиться:

Ссылка:

Скачать:

Готовим ссылку...

Добавить в:

Мой плейлист
Посмотреть позже
Комментарии : 56   
@louisdupreez2753
@louisdupreez2753 5 дней назад
Thank you so much for this sir. I wish I found your RU-vid channel 1 day ago - it would've saved me a lot of time! Be blessed
@karlgibbons5513
@karlgibbons5513 6 лет назад
I find it amazing that Microsoft do not have a simple function for this exercise. However, after trying a few other channels with this problem, this was the easiest by far. Worked like a dream first time. Many thanks.
@Computergaga
@Computergaga 6 лет назад
Thanks Karl. Yes its quite surprising this has not been solved.
@carolyn010
@carolyn010 6 лет назад
Thank you! I tried four other custom functions and this is the only one to do the trick. :)
@vandalo7494
@vandalo7494 7 лет назад
Only a clever person can explain with simplicity such cumbersome task. Nice video, clear explanation. Both thumbs up.
@AlexGandsas
@AlexGandsas 5 лет назад
Thank You very much. You really helped me with my project. Congratulations for such a great lesson!
@Computergaga
@Computergaga 5 лет назад
You're welcome Alex. Thank you.
@saramcmurray8303
@saramcmurray8303 6 лет назад
Thanks so much for this - I wish I found your RU-vid channel 3 hours ago - it would've saved me a lot of angst!
@Computergaga
@Computergaga 5 лет назад
You're welcome. Thank you Sara.
@catherineleow3399
@catherineleow3399 7 лет назад
Thank you so much. It works.
@Computergaga
@Computergaga 7 лет назад
Your welcome Catherine.
@ZoraAisling
@ZoraAisling Год назад
I kept getting an error, then decided to save my progress, and excel said I didn't have macros enabled... So I told it to enable them and it works! If anyone keeps getting an error that says you haven't put brackets in the right place, this might be your problem too.
@Computergaga
@Computergaga Год назад
Thank you, Kim.
@zozozozo43
@zozozozo43 7 лет назад
Thanks Mr. Alan
@Computergaga
@Computergaga 7 лет назад
Your welcome Assem.
@zozozozo43
@zozozozo43 7 лет назад
I'll be in touch with you, thank you for your effort!
@ivatosic6698
@ivatosic6698 7 лет назад
thank you a lot
@Computergaga
@Computergaga 7 лет назад
No problem Iva
@toyam2591
@toyam2591 7 лет назад
thank you
@Computergaga
@Computergaga 7 лет назад
Your welcome Mos Mos.
@TWENTY47x
@TWENTY47x 6 месяцев назад
Thank You
@Computergaga
@Computergaga 5 месяцев назад
You're welcome
@melikhayanohanyaza5105
@melikhayanohanyaza5105 6 лет назад
Hi Guys, thanks for all this beautiful work. I just want to know, how would the "custom function" which recognise font colour look like?
@DouglasP33
@DouglasP33 6 лет назад
This macro did what I wanted. But I am using a yearly calendar and I have it working where I shade a date with a color and it adds up the vacation/sick/personal time for me. BUT if I need to change anything it does't dynamically update, same if I just change the color using the color selector in the Home ribbon and not copying the target cell from the macro. Is there a way to make this dynamically checking for changes in the cell colors?
@dandanakan0
@dandanakan0 4 года назад
it's great thank you very much for sharing this. When changing the fill color of the ranged cells, returned counted value does not update the number of coloured cells unless you perform F2 + Enter, would that be possible to have it update the number of colored cells automatically when introducing these additional colored cells? thank you very much, highly appreciated.
@seifeddineboudris2586
@seifeddineboudris2586 Месяц назад
Did you find the solution i need help please
@zozozozo43
@zozozozo43 7 лет назад
Hello my brother Alan. If we change a color of some cell, the result of that color stay the same, though I refreshed other cells by changing it value also the result of that color stay the same, so I tried to refresh the formula which counts that colour then it gave me the new right result. well, i think we have to write the code in some place "like VB" onto "changing part".... but i can't find it in VBA of Excel
@zaroonbilal4986
@zaroonbilal4986 3 года назад
Thanks for making this video. Is there any way we can do same thing on online version.
@Computergaga
@Computergaga 3 года назад
Probably. VBA does not work online. It would need to be a script language.
@thriftymillionaire5968
@thriftymillionaire5968 5 лет назад
Please do you know how to formulate the following condition in excel; when you have two cells one with high and the other with low value and one of the cell is colored green. so you want to return a value of '1' if the lowest value amoung the two cell is green color and '0' is the highest value amoung the cell is green. is there a condition or formula for the statement in excel
@mikael9358
@mikael9358 14 дней назад
Hello, Not sure if i'll be able to explain this very well but here goes... I am trying to do this with cells that have conditional formatting which changes the colour of a cell depending on data in another cell. This video covers counting cells where the colour is manually inputed but is there a way of counting colours that are automatically changed due to conditional formatting rules? I input a date in one cell, the following cell will change colour when an date (e.g. =(E20+730) ) reaches within 45days (orange) and again (red) once the date has been passed... I'm hoping to create a dashboard on another page that can count when a box in a certain range has changed to these colours giving the option to quickly glance and see that no dates have expired passed a predetermined amount of days... Does that make sense?... Any ideas? Any help would be appreciated!... Thanks for your time! : )
@Computergaga
@Computergaga 13 дней назад
Hi, I just glanced over this question, however, I would forget about the colour change and focus on the criteria you're using. You can using a COUNTIFS or other formula to count the dates that are within 45 days of their corresponding date, or passed their corresponding date, no problem. Don't use the colour as the criteria for the dashboard.
@mikael9358
@mikael9358 13 дней назад
Interesting... Thank you so much for the advice, i'll start looking more at COUNTIFS for the solution... I'll start by scrolling through any vids you have on it👍🏼... Thanks again... : )
@tinachu8663
@tinachu8663 7 лет назад
Hello Computergaga, I have tried it and it won't work on the colour that's done with Conditional Formatting. Any solutions? Thanks for your help.
@pipbeeramontes1851
@pipbeeramontes1851 6 лет назад
Did you found a solution? i am also looking into that issue with Conditional formatting.
@thomasavinash72
@thomasavinash72 3 года назад
How to do the colour count dynamically with conditional formatting in place
@thomasavinash72
@thomasavinash72 3 года назад
Does it work with conditional formatting rule in place
@Computergaga
@Computergaga 3 года назад
No, this does not work with CF rules. You would re-create the condition for the CF rule in the count.
@spearmarster
@spearmarster 5 лет назад
hi, i've copied your module and inputted into my excel but my end result comes with '#NAME?' what am i doing wrong ?
@raziansar7943
@raziansar7943 7 лет назад
I made the same procedure a saw in your excel but did not get that option "COUNTIFCOLOUR" Let me know where I am making mistake?
@Computergaga
@Computergaga 7 лет назад
COUNTIFCOLOUR is just what I named the function procedure. If you followed the code it should work for you to. If you have since closed the file, ensure it was saved as a macro enabled file.
@marceloribeirosimoes8959
@marceloribeirosimoes8959 5 лет назад
Sadly, it doesn't recognizes Conditional Formatting color fill...
@derekdemitrius
@derekdemitrius 5 лет назад
How do we make it work automatically when the ccolor changes
@Computergaga
@Computergaga 5 лет назад
Write Application.Volatile in the function before the other lines. By making the function volatile it will calculate even when its dependent cell values are not changed.
@derekdemitrius
@derekdemitrius 5 лет назад
@@Computergaga Thank you, it worked exactly as you said it should ... one of the best ways of doing this I have read a million ways but this seemed the best way to do it.
@mjvlogs3250
@mjvlogs3250 4 года назад
Hi in my excel function is not showing using Windows 7
@Computergaga
@Computergaga 4 года назад
Shouldn't be a problem with the version. I would check through the steps. Something is missing.
@DanL-tg2fq
@DanL-tg2fq 5 лет назад
totally smashed by problem thanks very much. However how do i add this to 365 columns in one row so i can monitor how many coloured tabs are in each of the days columns lol
@Computergaga
@Computergaga 5 лет назад
Thank you Dan. Sorry I don't understand your question, but a VBA function can be copied similar to a worksheet function.
@DanL-tg2fq
@DanL-tg2fq 5 лет назад
@@Computergaga i needed to add the formula to a full year spreadsheet. 365 day columns, if more than 4 people were highlighted as off it would change to red. I managed it in the end :)
@raszico1
@raszico1 6 лет назад
So I tried this but the count keeps returning "0". Anything I'm doing wrong?
@Computergaga
@Computergaga 6 лет назад
Something is going wrong. I can't tell what from here. I would double check the code, ensure the colours are the same and do match ad check formulas are set to auto calculate on the Formulas tab.
@raszico1
@raszico1 6 лет назад
Thanks for your response. The colors are matching but I used the Conditional Formatting feature to color the cells; not sure if that's the reason the count is "0"
@Computergaga
@Computergaga 6 лет назад
That will be it. Unfortunately this example will not work with Conditional Formatting.
@raszico1
@raszico1 6 лет назад
Thank you.
@vbateaching8978
@vbateaching8978 3 года назад
HOW TO SOLVE THE VALUE UPDATE PROBLEM AFTER INSERTING A NEW PAINTED CELL: COMO RESOLVER O PROBLEMA DA ATUALIZAÇÃO DO VALOR APÓS INSERIR UMA NOVA CÉLULA PINTADA: Galera, aqui é o Estagivídeos Depois que você conseguir calcular o número de linhas preenchidas com cor, você deve gravar uma macro para atualizar esse valor toda vez que ocorrer alguma modificação na sua célula. 1° PASSO: Identifique a célula que está o resultado do número de células preenchidas com cor, ou seja, a célula que você colocou o resultado da macro. 2° PASSO: Ative essa célula em que está contido o resultado de sua macro, usando o seguinte código : Nesse exemplo o resultado da minha macro está na célula G10 cel_ativa = Range("G10").Activate 3° PASSO : Grave a macro. Após aperta o botão "Gravar Macro" lá na aba desenvolvedor, execute as seguintes ações > Der dois clicks na célula em que está o resultado de sua macro (nesse exemplo é célula G10). >Logo após, vai aparecer a formula contida nessa célula (aquela formula que foi colocada la no módulo com nome function). Após o cursos ficar piscando dentro da formula, pressione enter. Feito isso, pode parar de gravar a macro. O que você acabou de fazer foi atualizar o valor da célula que você pressionou ENTER. A macro vai ficar parecida com essa Range("G10").Select ActiveCell.FormulaR1C1 = "=IFERROR(contarcores(RC[-1],R2C1:ult_cor),"""")" Range("G11").Select Você vai precisar recortar essa parte ActiveCell.FormulaR1C1 = "=IFERROR(contarcores(RC[-1],R2C1:ult_cor),"""")" ela simplesmente está dando dois clicks e enter na célula que você ativou anteriormente lá no 2° PASSO, ou seja, essa linha de código atualiza o valor da célula ativada. Agora, você pode usar essa linha de código dentro do evento change por exemplo, pra toda vez que uma célula expecifica for alterada, ele activar sua célula que contem o valor da macro, dar dois cliks nela e depois enter, assim vai atualizar automatimente. Qualquer dúvida, mandem mensagem lá no meu canal que eu posso gravar um vídeo. SE INCREVAM POR GENTILEZA :)
Далее
Sum Cells Based on Their Color in Excel (Formula & VBA)
12:18
Sum By Cell Color... The Magic Comes True Without VBA
13:56
Use your Own Image as Macro Button on Ribbon
7:28
Просмотров 15 тыс.
How to COUNT COLORED cells.
5:09
Просмотров 10 тыс.
Ten Excel Paste Special Tricks to Make You a Pro
11:55
SUM and COUNT by Cell Colour in Excel -- WITHOUT VBA!
16:32
Excel Macro to Link all Checkboxes to a Cell
8:01
Просмотров 76 тыс.