Let formula?

Lacan

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

Would like help to complete Let formula in sheet.
In column D would like to Count Number of Names accordingly.
Any question please let me know.
Thank you very much! 🙏👍👍

PLANEAMENTO_18.AGO.xlsx
ABCDEFGHIJKLM
1
2BrickBrickNameEspecialidadeCenter
3363 St - SET (SSebastião, GPAGuerra, Sado)301 Lx - AMA (Venteira)354 St - ABC (CPiedade)DELFINA MEDICINA GERAL E FAMILIARHospital PARTICULAR DE ALMADA
4308 Lx - XPTO (Benfica - Sul)333 Lx - XPTO (Carnide)MARIA MEDICINA GERAL E FAMILIARHOSPITAL DA LUZ LISBOA
5CenterEspecialidadeCount Number of Names315 Lx - XPTO (SAntónio - Este)363 St - SET (SSebastião, GPAGuerra, Sado)LEONORMEDICINA GERAL E FAMILIARUSF BAIA AZUL (ULS ARRABIDA EPE)
6CH SETUBAL EPE - HOSPITAL DE SAO BERNARDOMEDICINA GERAL E FAMILIAR#REF!316 Lx - XPTO (SMMaior)363 St - SET (SSebastião, GPAGuerra, Sado)ANNACARDIOLOGIAUSF BAIA AZUL (ULS ARRABIDA EPE)
7USF BAIA AZUL (ULS ARRABIDA EPE)MEDICINA GERAL E FAMILIAR#REF!332 Lx - XPTO (SDBenfica - Norte)363 St - SET (SSebastião, GPAGuerra, Sado)JOHNCARDIOLOGIAUSF BAIA AZUL (ULS ARRABIDA EPE)
8USF BAIA AZUL (ULS ARRABIDA EPE)CARDIOLOGIA#REF!333 Lx - XPTO (Carnide)363 St - SET (SSebastião, GPAGuerra, Sado)DENISEGASTROUSF BAIA AZUL (ULS ARRABIDA EPE)
9USF BAIA AZUL (ULS ARRABIDA EPE)GASTRO#REF!333 Lx - XPTO (SDBenfica - Norte)363 St - SET (SSebastião, GPAGuerra, Sado)PAULNEUROUSF BAIA AZUL (ULS ARRABIDA EPE)
10USF BAIA AZUL (ULS ARRABIDA EPE)NEURO#REF!334 Lx - XPTO (SDBenfica - Norte)308 Lx - XPTO (Benfica - Sul)MARIA LUISAMEDICINA GERAL E FAMILIARUSF GERACOES (UCSP BENFICA)
11354 St - ABC (CPiedade)362 St - SET (SJulião, SMGraça)MANUELMEDICINA GERAL E FAMILIARSAMS - POSTO CLINICO REGIONAL DE SETUBAL
12357 St - ABC (Caparica, Trafaria)315 Lx - XPTO (SAntónio - Este)AUGUSTOMEDICINA INTERNACH LISBOA CENTRAL EPE - HOSPITAL STO ANTONIO DOS CAPUCHOS
13361 St - SET (NSAnunciada, SLourenço, SSimão)363 St - SET (SSebastião, GPAGuerra, Sado)ISABEL MEDICINA GERAL E FAMILIARCH SETUBAL EPE - HOSPITAL DE SAO BERNARDO
14362 St - SET (SJulião, SMGraça)301 Lx - AMA (Venteira)GILBERTO MEDICINA GERAL E FAMILIARHOSPITAL DR FERNANDO FONSECA EPE (AMADORA / SINTRA)
15363 St - SET (SSebastião, GPAGuerra, Sado)362 St - SET (SJulião, SMGraça)VITOR MEDICINA GERAL E FAMILIARPOSTO CLINICO PSP / SETUBAL
16362 St - SET (SJulião, SMGraça)JOSE MEDICINA GERAL E FAMILIARConsultorio DR. BOCAGE
17315 Lx - XPTO (SAntónio - Este)ANTONIOCARDIOLOGIACH LISBOA CENTRAL EPE - HOSPITAL SANTA MARTA
18332 Lx - XPTO (SDBenfica - Norte)JOAOREUMATOLOGIAHOSPITAL DA LUZ TORRES DE LISBOA
19333 Lx - XPTO (SDBenfica - Norte)LEO MEDICINA GERAL E FAMILIARHOSPITAL DA LUZ TORRES DE LISBOA
20334 Lx - XPTO (SDBenfica - Norte)JANNEMEDICINA GERAL E FAMILIARHOSPITAL DA LUZ TORRES DE LISBOA
21315 Lx - XPTO (SAntónio - Este)ANABELA CARDIOLOGIACH LISBOA CENTRAL EPE - HOSPITAL SANTA MARTA
22361 St - SET (NSAnunciada, SLourenço, SSimão)ALBERTO MANUELMEDICINA GERAL E FAMILIARHOSPITAL DA LUZ CLINICA LUISA TODI
23357 St - ABC (Caparica, Trafaria)ANTONIO MANUELMEDICINA GERAL E FAMILIARUSF VISTA TEJO (CS COSTA CAPARICA)
24316 Lx - XPTO (SMMaior)MANUEL FERNANDO CARDIOLOGIAClínica SOCORROS MUTUOS EMPREGADOS COMERCIO INDUSTRIA
25333 Lx - XPTO (Carnide)LUIS FILIPECARDIOLOGIAHOSPITAL DA LUZ LISBOA
26
27
28
29
30
31
32
Folha1
Cell Formulas
RangeFormula
H3:H15H3=SORT(UNIQUE(I3:I25))
B6:D10B6=LET( brick,I3:I27, center,L3:L27, especialidade,K3:K27,name,J3:J27,f,UNIQUE(FILTER(CHOOSE({2,3},brick,center,especialidade),(brick=B3))), ub,INDEX(f,0,1), uc,INDEX(f,0,2), ue,INDEX(f,0,3), somaespecialidade,COUNTIFS(especialidade,"*"),SORT(CHOOSE({1,2,3},ub,uc,ue),1))
Dynamic array formulas.
Cells with Data Validation
CellAllowCriteria
B3List=$H$3#
 
The row and column separators (";" and "," in North America, "," and "\" in your region) are defined in the Regional Settings. I should have thought of that, but you've figured it out now. The latest problem is due to the CHOOSE having trouble concatenating a list with a single row - the single row is assumed to be a constant that should go in every row. I found a workaround that makes the last 2 columns into a list if necessary.

Book2
ABCDEFGHIJKL
1
2BrickBrickNameEspecialidadeCenter
3333 Lx - XPTO (Carnide)301 Lx - AMA (Venteira)354 St - ABC (CPiedade)DELFINA MEDICINA GERAL E FAMILIARHospital PARTICULAR DE ALMADA
4308 Lx - XPTO (Benfica - Sul)333 Lx - XPTO (Carnide)MARIA MEDICINA GERAL E FAMILIARHOSPITAL DA LUZ LISBOA
5CenterEspecialidadeCount Number of NamesCenterCount Number of Names315 Lx - XPTO (SAntónio - Este)363 St - SET (SSebastião, GPAGuerra, Sado)LEONORMEDICINA GERAL E FAMILIARUSF BAIA AZUL (ULS ARRABIDA EPE)
6HOSPITAL DA LUZ LISBOAMEDICINA GERAL E FAMILIAR1316 Lx - XPTO (SMMaior)363 St - SET (SSebastião, GPAGuerra, Sado)ANNACARDIOLOGIAUSF BAIA AZUL (ULS ARRABIDA EPE)
7HOSPITAL DA LUZ LISBOACARDIOLOGIA1332 Lx - XPTO (SDBenfica - Norte)363 St - SET (SSebastião, GPAGuerra, Sado)JOHNCARDIOLOGIAUSF BAIA AZUL (ULS ARRABIDA EPE)
8333 Lx - XPTO (Carnide)363 St - SET (SSebastião, GPAGuerra, Sado)DENISEGASTROUSF BAIA AZUL (ULS ARRABIDA EPE)
9333 Lx - XPTO (SDBenfica - Norte)363 St - SET (SSebastião, GPAGuerra, Sado)PAULCARDIOLOGIAUSF BAIA AZUL (ULS ARRABIDA EPE)
10334 Lx - XPTO (SDBenfica - Norte)308 Lx - XPTO (Benfica - Sul)MARIA LUISAMEDICINA GERAL E FAMILIARUSF GERACOES (UCSP BENFICA)
11354 St - ABC (CPiedade)362 St - SET (SJulião, SMGraça)MANUELMEDICINA GERAL E FAMILIARSAMS - POSTO CLINICO REGIONAL DE SETUBAL
12357 St - ABC (Caparica, Trafaria)315 Lx - XPTO (SAntónio - Este)AUGUSTOCARDIOLOGIACH LISBOA CENTRAL EPE - HOSPITAL STO ANTONIO DOS CAPUCHOS
13361 St - SET (NSAnunciada, SLourenço, SSimão)363 St - SET (SSebastião, GPAGuerra, Sado)ISABEL MEDICINA GERAL E FAMILIARCH SETUBAL EPE - HOSPITAL DE SAO BERNARDO
14CenterEspecialidadeCount Number of NamesCenterCount Number of Names362 St - SET (SJulião, SMGraça)301 Lx - AMA (Venteira)GILBERTO MEDICINA GERAL E FAMILIARHOSPITAL DR FERNANDO FONSECA EPE (AMADORA / SINTRA)
15HOSPITAL DA LUZ LISBOAMEDICINA GERAL E FAMILIAR1HOSPITAL DA LUZ LISBOA2363 St - SET (SSebastião, GPAGuerra, Sado)362 St - SET (SJulião, SMGraça)VITOR MEDICINA GERAL E FAMILIARPOSTO CLINICO PSP / SETUBAL
16HOSPITAL DA LUZ LISBOACARDIOLOGIA1362 St - SET (SJulião, SMGraça)JOSE MEDICINA GERAL E FAMILIARConsultorio DR. BOCAGE
17315 Lx - XPTO (SAntónio - Este)ANTONIOCARDIOLOGIACH LISBOA CENTRAL EPE - HOSPITAL SANTA MARTA
18332 Lx - XPTO (SDBenfica - Norte)JOAOREUMATOLOGIAHOSPITAL DA LUZ TORRES DE LISBOA
19333 Lx - XPTO (SDBenfica - Norte)LEO MEDICINA GERAL E FAMILIARHOSPITAL DA LUZ TORRES DE LISBOA
20334 Lx - XPTO (SDBenfica - Norte)JANNEMEDICINA GERAL E FAMILIARHOSPITAL DA LUZ TORRES DE LISBOA
21315 Lx - XPTO (SAntónio - Este)ANABELA MED INTERNACH LISBOA CENTRAL EPE - HOSPITAL SANTA MARTA
22361 St - SET (NSAnunciada, SLourenço, SSimão)ALBERTO MANUELMEDICINA GERAL E FAMILIARHOSPITAL DA LUZ CLINICA LUISA TODI
23357 St - ABC (Caparica, Trafaria)ANTONIO MANUELMEDICINA GERAL E FAMILIARUSF VISTA TEJO (CS COSTA CAPARICA)
24316 Lx - XPTO (SMMaior)MANUEL FERNANDO CARDIOLOGIAClínica SOCORROS MUTUOS EMPREGADOS COMERCIO INDUSTRIA
25333 Lx - XPTO (Carnide)LUIS FILIPECARDIOLOGIAHOSPITAL DA LUZ LISBOA
Sheet2
Cell Formulas
RangeFormula
H3:H15H3=SORT(UNIQUE(I3:I25))
B6:D7B6=LET( brick,I3:I27, center,L3:L27, especialidade,K3:K27,name,J3:J27,f,UNIQUE(FILTER(CHOOSE({2,3},brick,center,especialidade),(brick=B3))), ub,INDEX(f,0,1), uc,INDEX(f,0,2), ue,INDEX(f,0,3), somaespecialidade,COUNTIFS(center,ub,especialidade,uc),SORT(CHOOSE({1,2,3},ub,uc,somaespecialidade),1))
B15:F16B15=LET(brick,I3:I27,center,L3:L27,especialidade,K3:K27,br,B3,f,SORT(UNIQUE(FILTER(CHOOSE({1,2},center,especialidade),brick=br)),1),ub,INDEX(f,0,1),uc,INDEX(f,0,2),somaespecialidade,COUNTIFS(center,ub,especialidade,uc),s,SEQUENCE(ROWS(ub)),ctr,UNIQUE(ub),ctrno,COUNTIFS(brick,br,center,ctr),IFERROR(CHOOSE({1,2,3,4,5},ub,uc,somaespecialidade,INDEX(ctr,s),INDEX(ctrno,s)),""))
Dynamic array formulas.

Now works fine @Eric W !!!🔝🔝👍
Sincerely just love your "Let" formulas. So simple, smooth and efficient!! 👌
Everytime a formula as presented in is Forum before applied it have to change it through an excel translator website .
It seems to me you and other members use a different method? Can you please let know?
Thanks again for everything @Eric W 🙏🙏
 
Upvote 0

Excel Facts

Who is Mr Spreadsheet?
Author John Walkenbach was Mr Spreadsheet until his retirement in June 2019.
I don't have any special tricks to translate a formula. I suggest the translator website if needed, and I know about the delimiters changing by region. Between those, I can usually figure out how to get a formula to work in different languages/regions.

Anyway, I'm glad it works for you!
 
Upvote 1
I don't have any special tricks to translate a formula. I suggest the translator website if needed, and I know about the delimiters changing by region. Between those, I can usually figure out how to get a formula to work in different languages/regions.

Anyway, I'm glad it works for you!

Thank you very much @Eric W !!! 👍👍
 
Upvote 0

Forum statistics

Threads
1,223,227
Messages
6,170,848
Members
452,361
Latest member
d3ad3y3

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