Formula Averageifs to ignore zero and negative time

Lukma

Board Regular
Joined
Feb 12, 2020
Messages
240
Office Version
  1. 2019
  2. 2016
Platform
  1. Windows
Hi guys

Can some help out with this formula i was trying to find the average of a time for every week, based on multiple criteria, but i need to ignore the negative time and blank or zero in cell so i am wondering if my formula is right in column C3

ILSP_Performance Tracking Data update.xlsx
BCDEFGHIJKLMNOPQRST
2YES
318:33
4WeeklyMonthly Mus End DateMus-NoSupply VesselFWB Date & TimeManifest Date & TimeMs't on TimeADNOC PermissionArrive Date & TimeCommence Cargo OPEx Trailer Delay TimeComplete Cargo OPVessel Depart AD-JettyW/ ADL&S To Grant Permission W/ ADL&S To Start Cargo Total Hrs from Arrival complete Exceeded Hrs KPI
5101-Jan-21Mus-3705ADNOC-810Half231/12/20 21:0031/12/20 11:05YES31/12/20 21:3401/01/21 00:5001/01/21 03:0001/01/21 09:0001/01/21 09:3010:292:108:10-03:50
65301-Dec-20Mus-3706ADNOC-224Half531/12/20 00:4531/12/20 11:30NO31/12/20 19:0931/12/20 23:0001/01/21 04:0001/01/21 18:2501/01/21 18:487:395:019:257:25
7101-Jan-213666-OASL SWIFTHalf201/01/21 06:30Off-HireNO01/01/21 11:3001/01/21 11:4002/01/21 03:4002/01/21 16:000:1016:104:10
8101-Jan-21Mus-3707Z-POWERHalf330/12/20 21:2530/12/20 22:00NO31/12/20 22:0801/01/21 01:1501/01/21 03:0001/01/21 11:2501/01/21 19:0024:81:4510:10-01:50
9101-Jan-21Mus-3708SMIT LUZONFull 131/12/20 22:4231/12/20 13:35YES01/01/21 04:1401/01/21 08:3001/01/21 08:4201/01/21 19:5401/01/21 20:3014:390:1211:24-00:36
10101-Jan-21Mus-3709SMIT LUMUTHalf331/12/20 22:3031/12/20 18:00YES31/12/20 23:0001/01/21 05:2001/01/21 07:5801/01/21 17:4501/01/21 19:155:02:3812:250:25
11101-Jan-21Mus-3710B-LIBERTY-313NAFNAF01/01/21 05:3031/12/20 19:30YES01/01/21 11:3001/01/21 15:0902/01/21 00:0002/01/21 12:0502/01/21 12:4516:08:5120:568:56
12101-Jan-21Mus-3711MAC PHOENIXHalf231/12/20 21:4231/12/20 20:35YES01/01/21 05:0501/01/21 09:4501/01/21 13:3001/01/21 20:2401/01/21 21:228:303:4510:39-01:21
13101-Jan-21Mus-3712ADNOC-812Half201/01/21 01:3031/12/20 21:00YES01/01/21 04:4501/01/21 08:0501/01/21 08:2501/01/21 20:2501/01/21 21:157:450:2012:200:20
14101-Jan-21Mus-3713A-HERCULESHalf301/01/21 04:0031/12/20 21:30YES01/01/21 09:5801/01/21 13:5001/01/21 15:4501/01/21 23:4002/01/21 00:3012:281:559:50-02:10
15101-Jan-21Mus-001LCT-TARFFAHFull 102/01/21 11:0001/01/21 11:45YES02/01/21 12:3902/01/21 16:0002/01/21 20:0003/01/21 05:4503/01/21 07:1024:544:013:451:45
16201-Jan-21Mus-002ADNOC-850Half202/01/21 20:1001/01/21 13:30YES02/01/21 20:3503/01/21 00:1503/01/21 03:2503/01/21 12:4503/01/21 13:1531:53:1012:300:30
17101-Jan-21Mus-003ADNOC-510Full 101/01/21 03:2401/01/21 12:52NO01/01/21 19:0502/01/21 00:0002/01/21 00:1502/01/21 14:0002/01/21 14:206:130:1514:02:0
18101-Jan-21Mus-004A-GRACEFull 101/01/21 05:0201/01/21 13:38NO01/01/21 17:0601/01/21 21:4001/01/21 23:5002/01/21 05:3502/01/21 06:153:282:107:55-04:05
19101-Jan-21Mus-005MARCAP-2Full 101/01/21 21:3001/01/21 14:15YES02/01/21 04:4402/01/21 08:3002/01/21 09:2502/01/21 17:3002/01/21 17:3514:290:559:0-03:00
20101-Jan-21Mus-006QMS DELTAHalf201/01/21 10:3001/01/21 16:20NO01/01/21 21:0002/01/21 01:0002/01/21 03:4002/01/21 21:3002/01/21 21:504:402:4020:308:30
21101-Jan-21Mus-007ADNOC-1011Half331/12/20 21:4501/01/21 17:00NO02/01/21 05:5202/01/21 10:2502/01/21 15:3503/01/21 02:2003/01/21 03:4012:525:1015:553:55
22101-Jan-21Mus-008QMS NEPTUNEHalf301/01/21 09:5001/01/21 17:20NO01/01/21 19:1402/01/21 00:1502/01/21 05:2002/01/21 18:1002/01/21 19:001:545:517:555:55
23101-Jan-21Mus-009ADNOC-221Half401/01/21 17:2001/01/21 17:40NO01/01/21 19:3001/01/21 23:5502/01/21 00:3002/01/21 23:0503/01/21 00:451:500:3523:1011:10
24101-Jan-21Mus-010SEACOR ALPSFull 101/01/21 22:3001/01/21 19:00YES01/01/21 22:4002/01/21 03:5002/01/21 04:5003/01/21 14:0003/01/21 14:103:401:034:1022:10
25101-Jan-21Mus-011ADNOC-229NAFNAF01/01/21 16:3001/01/21 22:10NO01/01/21 16:3001/01/21 17:3002/01/21 00:0002/01/21 22:0802/01/21 23:00-05:406:3028:3816:38
26101-Jan-21Mus-012LCT-MARWAH-1Full 102/01/21 05:0002/01/21 09:20NO02/01/21 09:3502/01/21 13:0502/01/21 15:4503/01/21 00:1003/01/21 00:500:152:4011:5-00:55
27101-Jan-21Mus-013Z-OCEANFull 102/01/21 04:0002/01/21 08:27NO02/01/21 08:4802/01/21 12:1802/01/21 12:5402/01/21 17:3002/01/21 17:300:210:365:12-06:48
28201-Jan-21Mus-014ADNOC-230NAFNAF02/01/21 22:1502/01/21 13:19YES03/01/21 00:4503/01/21 04:0003/01/21 04:2504/01/21 05:3004/01/21 16:3011:260:2525:3013:30
29101-Jan-21Mus-015A-LIBERTY Full 102/01/21 12:3002/01/21 13:55NO02/01/21 18:3002/01/21 22:2002/01/21 22:2003/01/21 04:5503/01/21 06:004:350:06:35-05:25
30201-Jan-21Mus-016ADNOC-851Full 102/01/21 23:0503/01/21 14:20NO03/01/21 00:4603/01/21 04:0003/01/21 07:5003/01/21 16:0503/01/21 16:30-13:343:5012:50:5
31201-Jan-21Mus-017ADNOC-225NAFNAF02/01/21 21:4502/01/21 20:50YES02/01/21 22:1003/01/21 02:0003/01/21 03:5003/01/21 23:5904/01/21 00:451:201:5021:599:59
32101-Jan-21Mus-018A-CHLOEFull 102/01/21 17:0002/01/21 16:55YES02/01/21 18:2002/01/21 22:3003/01/21 00:5003/01/21 11:3003/01/21 13:301:252:2013:01:0
Sheet1
Cell Formulas
RangeFormula
C3C3=AVERAGEIFS(Q5:Q32,J5:J32,"<>0"&B2,B5:B32,B3)
B5:B32B5=IF(L5<>"",WEEKNUM(L5,1),"")
Cells with Conditional Formatting
CellConditionCell FormatStop If True
I5:I32Cell Valuecontains "Maintenance"textNO
 

Excel Facts

Move date out one month or year
Use =EDATE(A2,1) for one month later. Use EDATE(A2,12) for one year later.
not sure exactly what you are doing
=AVERAGEIFS(Q5:Q32,J5:J32,"<>0"&B2,B5:B32,B3)

So get the average of Q5:Q32
Using criteria
Check if column J5;J32 where does NOT = 0 and YES
"<>0"&B2. NOT sure what you need here
And B5: B32 contains B3 = 1
you say
but i need to ignore the negative time and blank or zero in cell
What Cells give the range you are trying to ignore negative time and zero
IS this in column Q?

Please explain what you need with specific cell ranges

IE
Average of values in column Q
Where Column J = B2 (YES)
Where Column B = B3 (1)
AND values in column Q exclude any negative or zero value

Not sure how you are showing a negative time ?
Excel usually does not like that

You example does not show empty - blank cells or negative time
 
Upvote 0
Hi Etaf

Well Am Trying to find the average from column Q5 based on Criteria of YES in Column J5 and column B5 as Week
But i don't need to include negative sign and blank cell in column Q5 when looking for the average
 
Upvote 0
=AVERAGEIF(Q5:Q32,"<>0",Q5:Q32)
"<>0" will ignore blanks and zeros
Average of values in column Q
Where Column J = B2 (YES)
Where Column B = B3 (1)
AND values in column Q exclude any negative or zero value
=AVERAGEIFS(Q5:Q32,Q5:Q32,"<>0",J5:J32,B2,B5:B32,B3)
Still not sure what you mean by Negative Values ????
Can you show examples

Sample set - time issue-ETAF.xlsx
BCDEFGHIJKLMNOPQRST
2YES
3110:50:49
4WeeklyMonthly Mus End DateMus-NoSupply VesselFWB Date & TimeManifest Date & TimeMs't on TimeADNOC PermissionArrive Date & TimeCommence Cargo OPEx Trailer Delay TimeComplete Cargo OPVessel Depart AD-JettyW/ ADL&S To Grant Permission W/ ADL&S To Start Cargo Total Hrs from Arrival complete Exceeded Hrs KPI
511/1/213705ADNOC-810Half244196.87544196.4618YES44196.898644197.034744197.12544197.37544197.395810:29:000.090277780.340277780
65312/1/203706ADNOC-224Half544196.031344196.4792NO44196.797944196.958344197.166744197.767444197.783307:39:000.208333330.809027780.30902778
711/1/213666-OASL SWIFTHalf244197.2708Off-HireNO44197.479244197.486144198.152844198.66670.006944440.673611110.17361111
811/1/213707Z-POWERHalf344195.892444195.9167NO44196.922244197.052144197.12544197.475744197.791700:08:000.072916670.423611110
911/1/213708SMIT LUZONFull 144196.945844196.566YES44197.176444197.354244197.362544197.829244197.854214:39:000.008333330.475-00:36
1011/1/213709SMIT LUMUTHalf344196.937544196.75YES44196.958344197.222244197.331944197.739644197.802105:00:000.109722220.517361110.01736111
1111/1/213710B-LIBERTY-313NAFNAF44197.229244196.8125YES44197.479244197.63134419844198.503544198.531316:00:000.368750.872222220.37222222
1211/1/213711MAC PHOENIXHalf244196.904244196.8576YES44197.211844197.406344197.562544197.8544197.890308:30:000.156250.443750
1311/1/213712ADNOC-812Half244197.062544196.875YES44197.197944197.336844197.350744197.850744197.885407:45:000.013888890.513888890.01388889
1411/1/213713A-HERCULESHalf344197.166744196.8958YES44197.415344197.576444197.656344197.986144198.020812:28:000.079861110.409722220
1511/1/211LCT-TARFFAHFull 144198.458344197.4896YES44198.527144198.666744198.833344199.239644199.298600:54:000.166666670.572916670.07291667
1621/1/212ADNOC-850Half244198.840344197.5625YES44198.857644199.010444199.142444199.531344199.552107:05:000.131944440.520833330.02083333
1711/1/213ADNOC-510Full 144197.141744197.5361NO44197.79514419844198.010444198.583344198.597206:13:000.010416670.583333330.08333333
1811/1/214A-GRACEFull 144197.209744197.5681NO44197.712544197.902844197.993144198.232644198.260403:28:000.090277780.329861110
1911/1/215MARCAP-2Full 144197.895844197.5938YES44198.197244198.354244198.392444198.729244198.732614:29:000.038194440.375-03:00
2011/1/216QMS DELTAHalf244197.437544197.6806NO44197.87544198.041744198.152844198.895844198.909704:40:000.111111110.854166670.35416667
2111/1/217ADNOC-1011Half344196.906344197.7083NO44198.244444198.43444198.649344199.097244199.152812:52:000.215277780.663194440.16319444
2211/1/218QMS NEPTUNEHalf344197.409744197.7222NO44197.801444198.010444198.222244198.756944198.791701:54:000.211805560.746527780.24652778
2311/1/219ADNOC-221Half444197.722244197.7361NO44197.812544197.996544198.020844198.961844199.031301:50:000.024305560.965277780.46527778
2411/1/2110SEACOR ALPSFull 144197.937544197.7917YES44197.944444198.159744198.201444199.583344199.590303:40:000.041666671.423611110.92361111
2511/1/2111ADNOC-229NAFNAF44197.687544197.9236NO44197.687544197.72924419844198.922244198.958300:00:000.270833331.193055560.69305556
2611/1/2112LCT-MARWAH-1Full 144198.208344198.3889NO44198.399344198.545144198.656344199.006944199.034700:15:000.111111110.46180556-00:55
2711/1/2113Z-OCEANFull 144198.166744198.3521NO44198.366744198.512544198.537544198.729244198.729200:21:000.0250.216666670
2821/1/2114ADNOC-230NAFNAF44198.927144198.5549YES44199.031344199.166744199.18444200.229244200.687511:26:000.017361111.06250.5625
2911/1/2115A-LIBERTY Full 144198.520844198.5799NO44198.770844198.930644198.930644199.204944199.2504:35:0000.274305560
3021/1/2116ADNOC-851Full 144198.961844199.5972NO44199.031944199.166744199.326444199.670144199.687500:00:000.159722220.503472220.00347222
3121/1/2117ADNOC-225NAFNAF44198.906344198.8681YES44198.923644199.083344199.159744199.999344200.031301:20:000.076388890.915972220.41597222
3211/1/2118A-CHLOEFull 144198.708344198.7049YES44198.763944198.937544199.034744199.479244199.562501:25:000.097222220.541666670.04166667
33
34
3508:33:31
3609:14:36
Sheet2
Cell Formulas
RangeFormula
C3C3=AVERAGEIFS(Q5:Q32,Q5:Q32,"<>0",J5:J32,B2,B5:B32,B3)
Q35Q35=AVERAGE(Q5:Q32)
Q36Q36=AVERAGEIF(Q5:Q32,">0",Q5:Q32)
 
Upvote 0
Hi Etaf

Thanks well well to solve my issue can i ask if am using Averageifs can it ignore Zero and Negative sign ?
 
Upvote 0
as mentioned ,
What Cells give the range you are trying to ignore negative time
Not sure how you are showing a negative time ?
Excel usually does not like that

You example does not show .............. negative time
Still not sure what you mean by Negative Values ????
i dont understand the negative times
Can you explain and show the examples of where you use negative time

For negative values , blanks & zero - then you would need to use ">0"
 
Upvote 0

Forum statistics

Threads
1,214,979
Messages
6,122,561
Members
449,089
Latest member
Motoracer88

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