Simplified Formula

tdk1964

New Member
Joined
Oct 19, 2023
Messages
2
Office Version
  1. 365
Platform
  1. Windows
Hi,

1697730604996.png


Is there an easier or better way to sum the row and columns than these.
Rows
=IFERROR(MROUND(((IF(COUNT(C2:D2)=2,(D2-C2),0))+(IF(COUNT(E2:F2)=2,(F2-E2),0))+(IF(COUNT(G2:H2)=2,(H2-G2),0))+(IF(COUNT(I2:J2)=2,(J2-I2),0))+(IF(COUNT(K2:L2)=2,(L2-K2),0))+(IF(COUNT(M2:N2)=2,(N2-M2),0))+(IF(COUNT(O2:P2)=2,(P2-O2),0)))*24,0.1),0)

Columns
=IFERROR(MROUND((
IF(COUNT(C2:C2)=2,(D2-C2),0)+
IF(COUNT(C3:C3)=2,(D3-C3),0)+
IF(COUNT(C4:C4)=2,(D4-C4),0)+
IF(COUNT(C5:C5)=2,(D5-C5),0)+
IF(COUNT(C6:C6)=2,(D6-C6),0)+
IF(COUNT(C7:C7)=2,(D7-C7),0)+
IF(COUNT(C8:C8)=2,(D8-C8),0))*24,0.1),0)
 

Excel Facts

Save Often
If you start asking yourself if now is a good time to save your Excel workbook, the answer is Yes
Instead of just showing your formula, can you explain in words what you are trying to do?
 
Upvote 0
Just a note that this formula looks problematic to me:
Columns
=IFERROR(MROUND((
IF(COUNT(C2:C2)=2,(D2-C2),0)+
IF(COUNT(C3:C3)=2,(D3-C3),0)+
IF(COUNT(C4:C4)=2,(D4-C4),0)+
IF(COUNT(C5:C5)=2,(D5-C5),0)+
IF(COUNT(C6:C6)=2,(D6-C6),0)+
IF(COUNT(C7:C7)=2,(D7-C7),0)+
IF(COUNT(C8:C8)=2,(D8-C8),0))*24,0.1),0)
All your COUNT formulas, are only counting one cell (C2:C2 is just one cell, C3:C3 is just one cell, etc). So none of them can ever equal 2 (you can never count 1 cell and get 2!)
 
Upvote 0
Hi,
Thanks for the responses.
@Joe4 Yeah, I got that formula a bit wrong.
@Scott Huish You right, here's a better description.
What I'm trying to do is sum the number of hours for a column and row (there will be a lot of rows).
For example, Name 1 on Monday worked from 11 am to 11pm (12 hrs) so Mondays total is 12 (there are no other workers on Monday) and for the week it's 55.
Whilst my formula works it's very time consuming

Shift Planner.xlsx
ABCDEFGHIJKLMNOPQ
1Mon 30 OctTue 31 OctWed 01 NovThu 02 NovFri 03 NovSat 04 NovSun 05 NovTotal
2Section 1Name 111:00 -23:0011:00 -23:0011:00 -23:0011:00 -23:0011:00 -15:0011:00 -14:0055
3Name 213:00 -17:004
4Name 317:00 -23:0017:00 -23:0012
5Name 412:00 -23:0011
6Name 5-
7Total Hours1202223184382
Schedule (2)
Cell Formulas
RangeFormula
Q2:Q6Q2=IFERROR(MROUND(((IF(COUNT(C2:D2)=2,(D2-C2),0))+(IF(COUNT(E2:F2)=2,(F2-E2),0))+(IF(COUNT(G2:H2)=2,(H2-G2),0))+(IF(COUNT(I2:J2)=2,(J2-I2),0))+(IF(COUNT(K2:L2)=2,(L2-K2),0))+(IF(COUNT(M2:N2)=2,(N2-M2),0))+(IF(COUNT(O2:P2)=2,(P2-O2),0)))*24,0.1),0)
C7C7=IFERROR(MROUND((IF(COUNT(C2:D2)=2,(D2-C2),0)+IF(COUNT(C3:D3)=2,(D3-C3),0)+IF(COUNT(C4:D4)=2,(D4-C4),0)+IF(COUNT(C5:D5)=2,(D5-C5),0)+IF(COUNT(C6:D6)=2,(D6-C6),0))*24,0.1),0)
E7,G7,I7,K7,M7,O7E7=IFERROR(MROUND(( IF(COUNT(E2:F2)=2,(F2-E2),0)+ IF(COUNT(E3:F3)=2,(F3-E3),0)+ IF(COUNT(E4:F4)=2,(F4-E4),0)+ IF(COUNT(E5:F5)=2,(F5-E5),0)+ IF(COUNT(E6:F6)=2,(F6-E6),0))*24,0.1),0)
Q7Q7=SUM(Q2:Q6)
 
Upvote 0
Is there an easier or better way to sum the row and columns than these
Not sure if this is better but IMO it's simpler. Hope the formats show OK with the XL2BB
Book1
ABCDEFGHIJKLMNOPQ
1Mon 30 OctTue 31 OctWed 01 NovThu 02 NovFri 03 NovSat 04 NovSun 05 NovTotal
2Section 1Name 111:0023:0011:0023:0011:0023:0011:0023:0011:0015:0011:0014:0055
3Name 213:0017:004
4Name 317:0023:0017:0023:0012
5Name 412:0023:0011
6Name 5-
7Total Hours1202223184382
Sheet1
Cell Formulas
RangeFormula
Q2:Q6Q2=SUM(D2,F2,H2,J2,L2,N2,P2)-SUM(C2,E2,G2,I2,K2,M2,O2)
C7,E7,G7,I7,K7,M7,O7C7=SUM(D2:D6)-SUM(C2:C6)
Q7Q7=SUM(Q2:Q6)
 
Upvote 0

Forum statistics

Threads
1,215,103
Messages
6,123,107
Members
449,096
Latest member
provoking

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