How to filtered/extract names and calculate difference between values?

Lacan

Board Regular
Joined
Oct 5, 2016
Messages
240
Office Version
  1. 365
Platform
  1. Windows
Hi Guys,

Hope everyone is ok!👌👍
Would like some help in order to filtered/extract names and calculate difference between atual month (December) and average?
Some notes:
-Only names if value average is greater then value atual month;
-Not blank cells.
In sheet there is the example of Expected Results.
Any question, please let me know.
Thank you very much.
Big hug.💪💪🍻

Fórmula Principal para o Ficheiro VDF.xlsm
ABCDEFGHIJKLMNOPQ
1
2NAMESJAN. 2024FEV. 2024MAR. 2024ABR. 2024MAI. 2024JUN. 2024JUL. 2024AGO. 2024SET. 2024OUT. 2024NOV. 2024DEZ. 2024TOTALAVERAGE
3JOHN  
4ANNA3010055101016027
5LISA10435033787510010
6MARIE505010020067
7ROB1234100888413815
8
9EXPECTED RESULTS
10ANNA17
11LISA5
12ROB11
13
14
07-12-2024
Cell Formulas
RangeFormula
O3:O7O3=SUM(Tabela7[@[JAN. 2024]:[DEZ. 2024]])
P3:P7P3=IFERROR(AVERAGE(Tabela7[@[JAN. 2024]:[DEZ. 2024]]),"")
 
@Lacan Here we go:

MrExcel_2024-12.xlsm
BCDEFGHIJKLMNOPQ
2NAMESENE. LU.FEB. JU.MAR. VI.ABR. LU.MAY. MI.JUN. SÁ.JUL. LU.AGO. JU.SEP. DO.OCT. MA.NOV. VI.DIC. DO.TOTALAVERAGEEXCLUDE
3JOHN0 
4ANNA3010055101016027
5LISA10435033787510010
6MARIE505010050x
7ROB12341008881014416
8
9RESULTSTOTAL
10ANNA1728
11LISA5
12ROB6
07-12-2024 (2)
Cell Formulas
RangeFormula
C2:N2C2=TRANSPOSE(UPPER(TEXT(EDATE(EOMONTH(TODAY(),-12)+1,SEQUENCE(12,1,0)),"[$-es-ES]mmm aaa")))
O3:O7O3=SUM('07-12-2024 (2)'!$C3:$N3)
P3:P7P3=IFERROR(AVERAGE('07-12-2024 (2)'!$C3:$N3),"")
B10:C12B10=LET(Name,B3:B7,Tot,O3:O7,Avrg,P3:P7,curMonVal,XLOOKUP(UPPER(TEXT(TODAY(),"[$-es-ES]mmm aaa")),C2#,C3:N7,"N/A",0,1),deltaAV,IFERROR(ROUND(Avrg-curMonVal,0),0),crit,deltaAV>0,ex,Q3:Q7="",Result,FILTER(HSTACK(Name,deltaAV),(crit*ex)),Result)
D10D10=SUM(C10:C13)
Dynamic array formulas.


Just type anything into the EXCLUDE column and the corresponding row (Name) will be excluded.
 
Upvote 0

Excel Facts

Can you AutoAverage in Excel?
There is a drop-down next to the AutoSum symbol. Open the drop-down to choose AVERAGE, COUNT, MAX, or MIN
@Lacan Here we go:

MrExcel_2024-12.xlsm
BCDEFGHIJKLMNOPQ
2NAMESENE. LU.FEB. JU.MAR. VI.ABR. LU.MAY. MI.JUN. SÁ.JUL. LU.AGO. JU.SEP. DO.OCT. MA.NOV. VI.DIC. DO.TOTALAVERAGEEXCLUDE
3JOHN0 
4ANNA3010055101016027
5LISA10435033787510010
6MARIE505010050x
7ROB12341008881014416
8
9RESULTSTOTAL
10ANNA1728
11LISA5
12ROB6
07-12-2024 (2)
Cell Formulas
RangeFormula
C2:N2C2=TRANSPOSE(UPPER(TEXT(EDATE(EOMONTH(TODAY(),-12)+1,SEQUENCE(12,1,0)),"[$-es-ES]mmm aaa")))
O3:O7O3=SUM('07-12-2024 (2)'!$C3:$N3)
P3:P7P3=IFERROR(AVERAGE('07-12-2024 (2)'!$C3:$N3),"")
B10:C12B10=LET(Name,B3:B7,Tot,O3:O7,Avrg,P3:P7,curMonVal,XLOOKUP(UPPER(TEXT(TODAY(),"[$-es-ES]mmm aaa")),C2#,C3:N7,"N/A",0,1),deltaAV,IFERROR(ROUND(Avrg-curMonVal,0),0),crit,deltaAV>0,ex,Q3:Q7="",Result,FILTER(HSTACK(Name,deltaAV),(crit*ex)),Result)
D10D10=SUM(C10:C13)
Dynamic array formulas.


Just type anything into the EXCLUDE column and the corresponding row (Name) will be excluded.

Dear @PeteWright

Thanks again.
Fortunately figured out also how to add "exclude list" in your formula near to my job workbook.
To finish would like to add in your formula the sum function and to be integrated in an unique formula like in table "Expected Results".

To conclude please can you give a hand?
Thank you very much.💪💪🙏🍺🍺

Fórmula Principal para o Ficheiro VDF.xlsm
ABCDEFGHIJKLMNOPQ
1
2NAMESENE. 2024FEB. 2024MAR. 2024ABR. 2024MAY. 2024JUN. 2024JUL. 2024AGO. 2024SEP. 2024OCT. 2024NOV. 2024DIC. 2024TOTALAVERAGE
3JOHN  
4ANNA3010055101016027
5LISA10435033787510010
6MARIE505010050
7ROB12341008881014416
8
9EXPECTED RESULTSTOTALEXCLUDE LIST
10LISA555ANNA
11MARIE50ROB
12
13
07-12-2024 (2)
Cell Formulas
RangeFormula
C2:N2C2=TRANSPOSE(UPPER(TEXT(EDATE(EOMONTH(TODAY(),-12)+1,SEQUENCE(12,1,0)),"[$-es-ES]mmm aaa")))
O3:O7O3=SUM('07-12-2024 (2)'!$C3:$N3)
P3:P7P3=IFERROR(AVERAGE('07-12-2024 (2)'!$C3:$N3),"")
B10:C11B10=LET(Name,B3:B7,Tot,O3:O7,Avrg,P3:P7,curMonVal,XLOOKUP(UPPER(TEXT(TODAY(),"[$-es-ES]mmm aaa")),C2#,C3:N7,"N/A",0,1),deltaAV,IFERROR(ROUND(Avrg-curMonVal,0),0),crit,deltaAV>0,Result,FILTER(HSTACK(Name,deltaAV),crit*ISNA(MATCH(Name,F10:F12,0))),Result)
D10D10=SUM(C10:C13)
Dynamic array formulas.
 
Upvote 0
@Lacan How would you like it to be?
Fortunately figured out also how to add "exclude list" in your formula near to my job workbook.
To finish would like to add in your formula the sum function and to be integrated in an unique formula like in table "Expected Results".
Should the "exclude list" be some fixed range in your worksheet? If so, it would be "hard coded" and limited to a static number of exclusions.
That's why I came up with the idea of adding an extra column to the right of your table.
So you don't like it :cry:

Please let me know how you would like to handle excluded names and I'll incorporate that in a formula.

EDIT:
If you use an exclude list where you just "type in" the names there could also be a typo which would result in that name not being excluded.
Think about that too ;)
 
Upvote 0
P.S. How about checkboxes?

1733782318662.png


Edit 2:
Are there always 5 entries / names or can there be more?
 
Last edited:
Upvote 0
P.S. How about checkboxes?

View attachment 120201

Edit 2:
Are there always 5 entries / names or can there be more?

Dear @PeteWright

First, thank you very much!!! 🔝🔝
You´re the Greatest!!!! 💪💪👍👍
In my main List have almost 250 entries/names and in the exclude List contains 6 entries/names.
What you think to be pratical and efficient?

If you could would like to add the sum in your Let formula in order to sum all the entries/names if meet criteria.
1733869360641.png


We keep in touch my friend.
Very grateful!!!👍👍🍻
 
Upvote 0
Dear @PeteWright

First, thank you very much!!! 🔝🔝
You´re the Greatest!!!! 💪💪👍👍
In my main List have almost 250 entries/names and in the exclude List contains 6 entries/names.
What you think to be pratical and efficient?

If you could would like to add the sum in your Let formula in order to sum all the entries/names if meet criteria.
View attachment 120257

We keep in touch my friend.
Very grateful!!!👍👍🍻
Dear @PeteWright

Kindly reminder.💪🙏🍻
Thank you very much.
 
Upvote 0
Hello @Lacan

After many attempts with trial and error I think I have found the right formula. Try this:

MrExcel_2024-12.xlsm
ABCDEFGHIJKLMNOPQRSTU
1
2NAMESENE. 2024FEB. 2024MAR. 2024ABR. 2024MAY. 2024JUN. 2024JUL. 2024AGO. 2024SEP. 2024OCT. 2024NOV. 2024DIC. 2024TOTALAVERAGENAMEDELTATOTALEXCLUDE
3JOHN00LISA555ANNA
4ANNA3010055101016026.66667MARIE50ROB
5LISA10435033787510010
6MARIE505010050
7ROB12341008881014416
8
Table
Cell Formulas
RangeFormula
C2:N2C2=TRANSPOSE(UPPER(TEXT(EDATE(EOMONTH(TODAY(),-12)+1,SEQUENCE(12,1,0)),"[$-es-ES]mmm yyy")))
O3:O7O3=SUM(Table!$C3:$N3)
P3:P7P3=IFERROR(AVERAGEIF(Table!$C3:$N3,"<>0"),0)
R3:T4R3=LET(rowID,FILTER(ROW(B3:B1048576),NOT(ISBLANK(B3:B1048576)),""), NameCol,B:B, Name,CHOOSEROWS(NameCol,rowID), TotCol,O:O, Tot,CHOOSEROWS(TotCol,rowID), AvrgCol,P:P, Avrg,CHOOSEROWS(AvrgCol,rowID), curMonValCol,XLOOKUP(UPPER(TEXT(TODAY(),"[$-es-ES]mmm yyy")),C2#,C3:N1048576,"-",0,1), curMonVal,FILTER(curMonValCol,B3:B1048576<>"",0), deltaAV,Avrg-curMonVal, crit1a,deltaAV>0, crit1,FILTER(crit1a,NOT(ISNA(crit1a))), exCol,U3:U1048576, crit2a,FILTER(exCol,exCol<>0,""), crit2b,XMATCH(Name,crit2a,0,1), crit2,ISNA(crit2b), dArr,FILTER(deltaAV,crit1*crit2,0), TotRes,SUM(dArr), Result1,FILTER(HSTACK(Name,ROUND(deltaAV,0)), crit1*crit2,""), Result2,ROUND(TotRes,0), Result,IFNA(HSTACK(Result1,FILTER(Result2,Result2,"")),""), Result)
Dynamic array formulas.
Cells with Data Validation
CellAllowCriteria
U3:U8List=$B$3:$B$1048576



With Data Validation you won't get errors due to a typo in Name:
1734737802635.png


1734738137552.png



Although I have tested many conditions I would not consider the formula error-proof so please try it out and let me know if it works on your data.
 
Upvote 0
Hi @Lacan

I did not get any reply from you. Did this solve your problem? If so, please mark it as solution. Thanks
 
Upvote 0
Hi @Lacan

I did not get any reply from you. Did this solve your problem? If so, please mark it as solution. Thanks

Dear @PeteWright

First, Happy New Year 2025 for you and all of your Family.✨🥂
Just return 2 days ago from a short holidays and already back to full work.
Have a lot of things going on my life at the same time however need to improve my file with more efficient excel formulas and will schedule to see your formula next weekend with time and precision.
Sorry for the delay not forgotten because have also a few new excel challenges to ask in the Forum.👍🙏
Leet you know then.
Thank you very much for all the help and remembering!!! 🔝🔝👍
 
Upvote 0
Dear @PeteWright 🖐🖐

Im back - very sorry for the delay!!!
The Formula works Brilliant!!! 🔝🔝💪💪👍
However after a few tests just notice if first row doesnt have data the formula doesnt responds (Im sure you will fix it simple!)
Thank you thank you @PeteWright 👍👍🍻

Doesnt Working!
Fórmula Principal para o Ficheiro VDF.xlsm
ABCDEFGHIJKLMNOPQRSTUV
1
2NAMESENE. 2025FEB. 2025MAR. 2025ABR. 2025MAY. 2025JUN. 2025JUL. 2025AGO. 2025SEP. 2025OCT. 2025NOV. 2025DIC. 2025TOTALAVERAGENAMEDELTATOTALEXCLUDE
3JOHN  #VALOR!
4ANNA51005510513022
5LISA1043503378749910
6MARIE250502310721
7ROB123410088813417
8
9
07-12-2024 (4)
Cell Formulas
RangeFormula
C2:N2C2=TRANSPOSE(UPPER(TEXT(EDATE("01-01-2025",SEQUENCE(12,1,0)),"[$-es-ES]mmm aaa")))
O3:O7O3=SUM('07-12-2024 (4)'!$C3:$N3)
P3:P7P3=IFERROR(AVERAGE('07-12-2024 (4)'!$C3:$N3),"")
R3R3=LET(rowID,FILTER(ROW(B3:B1048576),NOT(ISBLANK(B3:B1048576)),""), NameCol,B:B, Name,CHOOSEROWS(NameCol,rowID), Paracol,O:O, Tot,CHOOSEROWS(Paracol,rowID), AvrgCol,P:P, Avrg,CHOOSEROWS(AvrgCol,rowID), curMonValCol,XLOOKUP(UPPER(TEXT(TODAY(),"[$-es-ES]mmm aaa")),C2#,C3:N1048576,"-",0,1), curMonVal,FILTER(curMonValCol,B3:B1048576<>"",0), deltaAV,Avrg-curMonVal, crit1a,deltaAV>0, crit1,FILTER(crit1a,NOT(ISNA(crit1a))), exCol,U3:U1048576, crit2a,FILTER(exCol,exCol<>0,""), crit2b,XMATCH(Name,crit2a,0,1), crit2,ISNA(crit2b), dArr,FILTER(deltaAV,crit1*crit2,0), TotRes,SUM(dArr), Result1,FILTER(HSTACK(Name,ROUND(deltaAV,0)), crit1*crit2,""), Result2,ROUND(TotRes,0), Result,IFNA(HSTACK(Result1,FILTER(Result2,Result2,"")),""), Result)
Dynamic array formulas.


Working!!!
Fórmula Principal para o Ficheiro VDF.xlsm
ABCDEFGHIJKLMNOPQRSTUV
1
2NAMESENE. 2025FEB. 2025MAR. 2025ABR. 2025MAY. 2025JUN. 2025JUL. 2025AGO. 2025SEP. 2025OCT. 2025NOV. 2025DIC. 2025TOTALAVERAGENAMEDELTATOTALEXCLUDE
3JOHN222ANNA1752
4ANNA51005510513022MARIE19
5LISA1043503378749910ROB16
6MARIE250502310721
7ROB123410088813417
8
9
07-12-2024 (4)
Cell Formulas
RangeFormula
C2:N2C2=TRANSPOSE(UPPER(TEXT(EDATE("01-01-2025",SEQUENCE(12,1,0)),"[$-es-ES]mmm aaa")))
O3:O7O3=SUM('07-12-2024 (4)'!$C3:$N3)
P3:P7P3=IFERROR(AVERAGE('07-12-2024 (4)'!$C3:$N3),"")
R3:T5R3=LET(rowID,FILTER(ROW(B3:B1048576),NOT(ISBLANK(B3:B1048576)),""), NameCol,B:B, Name,CHOOSEROWS(NameCol,rowID), Paracol,O:O, Tot,CHOOSEROWS(Paracol,rowID), AvrgCol,P:P, Avrg,CHOOSEROWS(AvrgCol,rowID), curMonValCol,XLOOKUP(UPPER(TEXT(TODAY(),"[$-es-ES]mmm aaa")),C2#,C3:N1048576,"-",0,1), curMonVal,FILTER(curMonValCol,B3:B1048576<>"",0), deltaAV,Avrg-curMonVal, crit1a,deltaAV>0, crit1,FILTER(crit1a,NOT(ISNA(crit1a))), exCol,U3:U1048576, crit2a,FILTER(exCol,exCol<>0,""), crit2b,XMATCH(Name,crit2a,0,1), crit2,ISNA(crit2b), dArr,FILTER(deltaAV,crit1*crit2,0), TotRes,SUM(dArr), Result1,FILTER(HSTACK(Name,ROUND(deltaAV,0)), crit1*crit2,""), Result2,ROUND(TotRes,0), Result,IFNA(HSTACK(Result1,FILTER(Result2,Result2,"")),""), Result)
Dynamic array formulas.
 
Upvote 0

Forum statistics

Threads
1,225,626
Messages
6,186,087
Members
453,336
Latest member
Excelnoob223

We've detected that you are using an adblocker.

We have a great community of people providing Excel help here, but the hosting costs are enormous. You can help keep this site running by allowing ads on MrExcel.com.
Allow Ads at MrExcel

Which adblocker are you using?

Disable AdBlock

Follow these easy steps to disable AdBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the icon in the browser’s toolbar.
2)Click on the "Pause on this site" option.
Go back

Disable AdBlock Plus

Follow these easy steps to disable AdBlock Plus

1)Click on the icon in the browser’s toolbar.
2)Click on the toggle to disable it for "mrexcel.com".
Go back

Disable uBlock Origin

Follow these easy steps to disable uBlock Origin

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back

Disable uBlock

Follow these easy steps to disable uBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back
Back
Top