Simplify formula

MiGon

New Member
Joined
Oct 27, 2020
Messages
28
Office Version
  1. 2013
Platform
  1. Windows
Hi Guys,
Is there any way to simplify formula below, please
I need to count how many times names occured for 3 shifts each day a week (new sheet is added each week)
Best would be use sheets index start from last one
Thanks
M
Excel Formula:
=((COUNTIF('[Rota 2022.xlsx]Wk beg 28112022'!B4,$G2))+(COUNTIF('[Rota 2022.xlsx]Wk beg 28112022'!E4,$G2))+(COUNTIF('[Rota 2022.xlsx]Wk beg 28112022'!H4,$G2))+(COUNTIF('[Rota 2022.xlsx]Wk beg 28112022'!K4,$G2))+(COUNTIF('[Rota 2022.xlsx]Wk beg 28112022'!N4,$G2))+((COUNTIF('[Rota 2022.xlsx]Wk beg 21112022'!B4,$G2))+(COUNTIF('[Rota 2022.xlsx]Wk beg 21112022'!E4,$G2))+(COUNTIF('[Rota 2022.xlsx]Wk beg 21112022'!H4,$G2))+(COUNTIF('[Rota 2022.xlsx]Wk beg 21112022'!K4,$G2))+(COUNTIF('[Rota 2022.xlsx]Wk beg 21112022'!N4,$G2))))+((COUNTIF('[Rota 2022.xlsx]Wk beg 14112022'!B4,$G2))+(COUNTIF('[Rota 2022.xlsx]Wk beg 14112022'!E4,$G2))+(COUNTIF('[Rota 2022.xlsx]Wk beg 14112022'!H4,$G2))+(COUNTIF('[Rota 2022.xlsx]Wk beg 14112022'!K4,$G2))+(COUNTIF('[Rota 2022.xlsx]Wk beg 14112022'!N4,$G2)))+((COUNTIF('[Rota 2022.xlsx]Wk beg 07112022'!B4,$G2))+(COUNTIF('[Rota 2022.xlsx]Wk beg 07112022'!E4,$G2))+(COUNTIF('[Rota 2022.xlsx]Wk beg 07112022'!H4,$G2))+(COUNTIF('[Rota 2022.xlsx]Wk beg 07112022'!K4,$G2))+(COUNTIF('[Rota 2022.xlsx]Wk beg 07112022'!N4,$G2)))
 

Excel Facts

Highlight Duplicates
Home, Conditional Formatting, Highlight Cells, Duplicate records, OK to add pink formatting to any duplicates in selected range.
You can use the formula below if counting C, D, F,G, I, J, L and M column is not a big deal. You should use another formula if you have to exclude them.
Excel Formula:
=COUNTIFS('[Rota 2022.xlsx]Wk beg 28112022'!B4:N4,$G2,'[Rota 2022.xlsx]Wk beg 21112022'!B4:N4,$G2,'[Rota 2022.xlsx]Wk beg 14112022'!B4:N4,$G2,'[Rota 2022.xlsx]Wk beg 07112022'!B4:N4,$G2)
 
Upvote 0
You can use the formula below if counting C, D, F,G, I, J, L and M column is not a big deal. You should use another formula if you have to exclude them.
Excel Formula:
=COUNTIFS('[Rota 2022.xlsx]Wk beg 28112022'!B4:N4,$G2,'[Rota 2022.xlsx]Wk beg 21112022'!B4:N4,$G2,'[Rota 2022.xlsx]Wk beg 14112022'!B4:N4,$G2,'[Rota 2022.xlsx]Wk beg 07112022'!B4:N4,$G2)
Hi,
That would create a mess as do not need count other columns.
One of my sheets looks like below
 

Attachments

  • Capture Rota.PNG
    Capture Rota.PNG
    65.3 KB · Views: 6
Upvote 0
How about
Excel Formula:
=SUMPRODUCT(('[Rota 2022.xlsx]Wk beg 28112022'!B4:N4=G2)*(MOD(COLUMN('[Rota 2022.xlsx]Wk beg 28112022'!B4:N4),3)=2))
& do the same for the other sheets & add them together.
 
Last edited:
Upvote 0
How about
Excel Formula:
=SUMPRODUCT(('[Rota 2022.xlsx]Wk beg 28112022'!B4:N4=G2)*(MOD(COLUMN('[Rota 2022.xlsx]Wk beg 28112022'!B4:N4),3)=2))
& do the same for the other sheets & add them together.
Hi Fluff,Thank you for the response, will go through formula, let you know how it works.
Thanks
M
 
Upvote 0
Hi Fluff,
I cannot get this working, getting 0 as result as not familiar with this formula could you kindly put some light on it, please
Excel Formula:
=SUMPRODUCT(('[Rota 2022.xlsx]Wk beg 28112022'!B14:P14=G12)*(MOD(COLUMN('[Rota 2022.xlsx]Wk beg 28112022'!B14:P14),3)=2))
amended the formula but not sure where to start
Thank you
M
 
Upvote 0
The formula will count how many cells in cols B, E, H, K & N for row 14 match the value in G12.
If you are getting 0 then check that you don't have any leading/trailing spaces in any of those cells.
 
Upvote 0
For C, F etc change the =2 to =3 & for the D, G etc use =1
 
Upvote 0

Forum statistics

Threads
1,215,326
Messages
6,124,258
Members
449,149
Latest member
mwdbActuary

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