Can you use XLOOKUP and COUNTA together?

jodilynnem

New Member
Joined
Jul 18, 2023
Messages
4
Office Version
  1. 2021
Platform
  1. Windows
I would like column B in the 'Analysis' table below to count how many subjects there are for each candidate in the 'Results' table. However I would like to try and do this using header names as opposed to cell references as this is going to be a very large table which will keep growing. I was thinking there might be a way to combine XLOOKUP with COUNTA but cant work it out. Any ideas? Unfortunately I can't have all of the subject columns next each other, they need to be separated by their scores.

Table Name: Analysis
1689671627499.png


Table Name: Results
1689671564103.png
 

Excel Facts

Last used cell?
Press Ctrl+End to move to what Excel thinks is the last used cell.
Welcome to the MrExcel board!

I would like to try and do this using header names as opposed to cell references
What exactly do you mean by that?
What relevance does that have to the size of the table?

What are the expected results for that sample data and why? Can you post again with the expected results and using XL2BB so that we can easily copy for testing?
 
Upvote 0
Welcome to the MrExcel board!


What exactly do you mean by that?
What relevance does that have to the size of the table?

What are the expected results for that sample data and why? Can you post again with the expected results and using XL2BB so that we can easily copy for testing?
Thank you, although I think I have just worked it out. I am going to use the following formula in column B of the Analysis table:

=COUNTA(Results[@[Sub 1]],Results[@[Sub 2]],Results[@[Sub 3]],Results[@[Sub 4]],Results[@[Sub 5]],Results[@[Sub 6]],Results@[Sub 7]])

Turned out I wasn't putting the extra brackets around the header reference which is why it wasn't working.
 
Upvote 0
This function may work a little better for you as far as ease in adding new subjects:

Book1
ABCDEFGHIJKLMNO
1ID NumberNbr of Scores
2123456785
3123456774
4123456767
5123456756
6123456746
7
8
9
10Sub 1Score 1Sub 2Score 2Sub 3Score 3Sub 4Score 4Sub 5Score 5Sub 6Score 6Sub 7Score 7
1112345678VSE8QQU7GTU2LFU6GFV9
1212345677TIX6TVA8DRG5WPX6
1312345676RDK3RGM6TPK6HRC9OSK4PKW4PTJ4
1412345675SVA6KWJ9XNZ8WZG4XWZ2UPU8
1512345674NLV7HYZ2JPZ7FSF2UZX9EHE7
Sheet1
Cell Formulas
RangeFormula
B2:B6B2=SUM((--(ISTEXT($B$11:$O$15)))*(ISNUMBER(FIND("Sub",$B$10:$O$10)))*(A2=$A$11:$A$15))
 
Upvote 0
What about this shorter version? Automatically expands/contracts if the results table is increased/decreased.

Results table

jodilynnem.xlsm
ABCDEFGHIJKLMNO
1ID NumberSub 1Score 1Sub 2Score 2Sub 3Score 3Sub 4Score 4Sub 5Score 5Sub 6Score 6Sub 7Score 7
212345678Bi8Ch8En6Lit6Fr5
312345677Ar6Bi7Ch6Ph6
412345676Ar8Bi8Dr8En8Lit8Fr7Gg8
512345675Ar9Ch7En6Lit7Gg7Ma7
612345674Ar9Ch7Hi7Cn5En7Lit7
Sheet1


Analysis (my formula in col B, yours in C)

jodilynnem.xlsm
ABC
1ID NumberNumber of ScoresNumber of Scores2
21234567855
31234567744
41234567677
51234567566
61234567466
Sheet2
Cell Formulas
RangeFormula
B2:B6B2=COUNT(FILTER(Results,Results[ID Number]=[@[ID Number]]))-1
C2:C6C2=COUNTA(Results[@[Sub 1]],Results[@[Sub 2]],Results[@[Sub 3]],Results[@[Sub 4]],Results[@[Sub 5]],Results[@[Sub 6]],Results[@[Sub 7]])
 
Upvote 0

Forum statistics

Threads
1,216,153
Messages
6,129,176
Members
449,491
Latest member
maxim_sivakon

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