automate the formula - sum and countifs with unknown number of sheets.

aleksandrae

New Member
Joined
Sep 28, 2022
Messages
6
Office Version
  1. 365
Platform
  1. Windows
Hi,

I have formula as below ad its works. However I need to know in advance how many sheets I will have and then add it into formula by hand. Is there any solution to automate it? I've tried indirect formula but it does works (maybe I use it in wrong way).

=SUM(IFNA(COUNTIFS(INDEX('1*'!$C$2:$E$125,MATCH($A10,'1*'!$A$2:$A$125,0),MATCH(D$1,'1*'!$C$1:$E$1,0)),"p"),0),IFNA(COUNTIFS(INDEX('2*'!$C$2:$E$125,MATCH($A10,'2*'!$A$2:$A$125,0),MATCH(D$1,'2*'!$C$1:$E$1,0)),"p"),0),IFNA(COUNTIFS(INDEX('3*'!$C$2:$E$125,MATCH($A10,'3*'!$A$2:$A$125,0),MATCH(D$1,'3*'!$C$1:$E$1,0)),"p"),0))


Ps. I paste only the formula and jpg because I have a problem with copy/paste mini-sheet (you already try to help me;))
thanks in advance,
Aleksandra
 

Excel Facts

How to show all formulas in Excel?
Press Ctrl+` to show all formulas. Press it again to toggle back to numbers. The grave accent is often under the tilde on US keyboards.
Are the ranges A2:A125 and C1:E1 in the exact same order on every sheet?

If they are then you could make things a lot easier by only doing the 2 matches on one sheet to identify the result cell, then do the rest from that.
 
Upvote 0
Are the ranges A2:A125 and C1:E1 in the exact same order on every sheet?

If they are then you could make things a lot easier by only doing the 2 matches on one sheet to identify the result cell, then do the rest from that.
ranges in column A are the same, but in main sheet in row 1 I have date from all month: 1.09; 2.09; 3.09 ... In sheets I add in range C1:E1 I have only 3 chosen data, e.g. sheet (1): 1.09; 5.09; 10.09; sheet (2): 4.09; 5,09; 11.09 ......
It looks like this:
main sheet:
namesum1.092.093.094.095.096.097.098.099.0910.0911.0912.0913.0914.0915.0916.0917.0918.0919.0920.0921.0922.0923.0924.0925.0926.0927.0928.0929.0930.09
John6
2​
2​
2​
Anna2
2​
0​
0​
Mark0
0​
0​
0​
Georg6
2​
2​
2​
Ben0
0​
0​
0​
Sophia0
0​
0​
0​
Susan6
2​
2​
2​

sheets I add (this sheets is unknown number at the beginning of the month) - each sheet will have different dates in row 1 (however some of the could be the same).

namesum2.098.0910.09
John3ppp
Anna1p
Mark0
Georg3ppp
Ben0
Sophia0
Susan3ppp
 
Upvote 0
I'll try a couple of things and see if I can come up with anything, but in all honesty I think that you have too many unknown variables for this to work.
 
Upvote 0

Forum statistics

Threads
1,214,832
Messages
6,121,843
Members
449,051
Latest member
excelquestion515

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