SUMIFS based on multiple criteria and between date

Lukma

Active Member
Joined
Feb 12, 2020
Messages
259
Office Version
  1. 2019
  2. 2016
Platform
  1. Windows
Good day friends

I need to help out with a formula on my data sheet the problem is the given tasks and its required and doing so it will take a long and stressful time
so i need a formula that and sum total for specific criteria between date rage.

From Column A i have all Vessel names listed
From Column B Activity Range
From Column D to Colum AH i have date numbers
Now
Column AL i have Vessel Name
Column AM Start Date
Column AN Return Date
From AO to AX i have list criteria Name from Column B Activities

So i need to sumifs based on multiple criteria between dates
So let say from Column AM date 2 and AN 7
then i need to sum Column D date 2 to 7 all time based on Criteria

Thank i will appreciate any one with helping and and i hope am able to explain better

regards

Book2
ABCDEFGHIJKLMNOPQRSTUVWXYZAAABACADAEAFAGAHAIAJAKALAMANAOAPAQARASATAUAVAWAX
1Vessel NamesOperational Month & Date12345678910111213141516171819202122232425262728293031Total / HrsIn DaysVessel NameeStart Date & Time (Arrival Time at MOSB)Return to MOSB Date & TimeWaiting VTSWaiting COP MOSBWorking MOSBSteamingWorking OffshoreWorking Others Marine SupplyWaiting OffshoreWaiting DaylightWaiting WeatherMaintenance
2A-CHLOEWorking MOSBADNOC Base Jetty Cargo Operation15.4155.314.51.21114.412.92.892.53.85A-CHLOE02/01/23 06:2007/01/23 01:20
3A-CHLOEWaiting COP MOSBWaitng ADNOC Berthing Instruction00.00A-CHLOE07/01/23 01:2011/01/23 18:30
4A-CHLOEWaiting COP MOSBWaiting Base Cargo Operation00.00A-CHLOE11/01/23 18:3019/01/23 01:10
5A-CHLOEWaiting ADOF SupplierWaitng Drilling Material00.00A-CHLOE19/01/23 01:1025/01/23 08:50
6A-CHLOEWaiting COP MOSBCargo Operation Suspended00.00A-CHLOE25/01/23 08:5002/02/23 07:00
7A-CHLOEWaiting VTSWaiting VTS permission1.64.3813.90.58A-GRACE01/01/23 10:2006/01/23 06:50
8A-CHLOEWaiting VTSWaiting on Channel Closure00.00A-GRACE06/01/23 06:5010/01/23 01:25
9A-CHLOEWaiting WeatherWaitinhg WOW , FOG / POOR VISIBILITY00.00A-GRACE10/01/23 01:2519/01/23 08:00
10A-CHLOESteaming In Transit / Steaming to Location 3.18.6711.43.911.8130.53.37.59.9803.33A-GRACE19/01/23 08:0025/01/23 01:30
11A-CHLOEWorking Free-PortFree-Port / Mus-Port00.00A-GRACE25/01/23 01:3031/01/23 18:25
12A-CHLOEWaiting COP Free-PortStandby location ( Waiting )00.00A-GRACE31/01/23 18:2503/02/23 23:10
Sheet1
Cell Formulas
RangeFormula
AI2:AI12AI2=SUM(D2:AH2)
AJ2:AJ12AJ2=AI2/24
 
you seem to be using a different formula now

=IFERROR(1/(1/SUMPRODUCT(($E$2:$AI$1728)*($A$2:$A$1728=$AL2)*($B$2:$B$1728=$AM2)*($C$2:$C$1728=AP$1)*($E$1:$AI$1>=DAY($AN2))*(($E$1:$AI$1<=DAY($AO2))))),"")

add up the values in
$E$2:$AI$1728 which comes to - 451.6
but only if
column a = al2 = 1st jan 23
=SUMPRODUCT((E2:AI17)*(A2:A17=AL2))
which a2 to a17 is - so stll 451.6

=SUMPRODUCT((E2:AI17)*(A2:A17=AL2)*($B$2:$B$17=$AM2))
now only if b has am2
LCT ADNOC-1010
they all do - so stll 451.6

next column c = ap1
Channel Waiting Time & VTS Delay
so now result is 5.9

next
$E$1:$AI$1>=DAY($AN2))*(($E$1:$AI$1<=DAY($AO2))))),
day an2 = 1
day ao2 = 5
still 5.9 , as that intered for day 2
so still 5.9

1/1/5.9
=
0.169491525

not sure on question
if i change an2 - so its the 2nd and also ao2 to 2nd
still works

Book3
ABCDEFGHIJKLMNOPQRSTUVWXYZAAABACADAEAFAGAHAIAJAKALAMANAOAPAQARASATAUAVAWAXAYAZBA
1Vessel NamesCriOperational Month & Date12345678910111213141516171819202122232425262728293031Total / HrsIn DaysVessel NameeStart Date & Time (Arrival Time at MOSB)Return to MOSB Date & TimeChannel Waiting Time & VTS DelayWaiting Cargo Operation & Berth (MOSB Base)Work Time at MOSBTotal SteamingInfield SteamingTotal Working Hours at Offshore LocationsWorking Others Marine Supply Waiting Time at Offshore LcoationsWaiting Daylight ComplexWaiting On WeatherMaintenance Days
21/1/23LCT ADNOC-1010Work Time at MOSBADNOC Base Jetty Cargo Operation0.810.20.79.910.37.60.310.53.21.511.93.91.572.33.0125Sunday 1 January 2023LCT ADNOC-1010Monday 2 January 2023Monday 2 January 20230.2458333330.13750.4250.191666667       0.169491525
Sheet1
Cell Formulas
RangeFormula
AJ2AJ2=SUM(E2:AI2)
AK2AK2=AJ2/24
AL2AL2=IFERROR(EOMONTH(AN2,-1)+1,"")
AP2:AZ2AP2=IFERROR(1/(1/SUMPRODUCT(($E$2:$AI$1728)*($A$2:$A$1728=$AL2)*($B$2:$B$1728=$AM2)*($C$2:$C$1728=AP$1)*($E$1:$AI$1>=DAY($AN2))*(($E$1:$AI$1<=DAY($AO2)))))/24,"")
BA2BA2=1/1/(SUMPRODUCT((E2:AI17)*(A2:A17=AL2)*($B$2:$B$17=$AM2)*($C$2:$C$17=AP$1)*($E$1:$AI$1>=DAY($AN2))*(($E$1:$AI$1<=DAY($AO2)))))




good morning etaf

Thanks for your pronto feedback and guidelines let me insert it and see how result goes
many thanks
with
regards
 
Upvote 0

Excel Facts

Is there a shortcut key for strikethrough?
Ctrl+S is used for Save. Ctrl+5 is used for Strikethrough. Why Ctrl+5? When you use hashmarks to count |||| is 4, strike through to mean 5.
Good Morning Etaf

Thank you, however, to answer and provide more details I need the formula result to extract and be able to capture what I need within the date
I have highlighted each date range I need the extraction with the formula.

For example, Column=AN has the date of 1/01/2023 and Column=AO is 05/01/2023 is the original date range, but to get and capture the right statistics, I need to minus one day from the return day
so I would want the formula to do this, to always calculate from the start date days and the minus one day from the Return date then i can get the actual and extract all entries for each month

I have manually Do sum example of what I need a formula to sum up based on the criteria name and from the date range


Regards


Working.xlsx
ABCDEFGHIJKLMNOPQRSTUVWXYZAAABACADAEAFAGAHAIAJAKALAMANAOAPAQARASATAUAVAWAXAYAZ
1Vessel NamesCriOperational Month & Date12345678910111213141516171819202122232425262728293031Total / HrsIn DaysVessel NameeStart Date & Time (Arrival Time at MOSB)Return to MOSB Date & TimeChannel Waiting Time & VTS DelayWaiting Cargo Operation & Berth (MOSB Base)Work Time at MOSBTotal SteamingInfield SteamingTotal Working Hours at Offshore LocationsWorking Others Marine Supply Waiting Time at Offshore LcoationsWaiting Daylight ComplexWaiting On WeatherMaintenance Days
2JanuaryLCT ADNOC-1010Work Time at MOSBADNOC Base Jetty Cargo Operation0.810.20.79.910.37.60.310.53.21.511.93.91.572.33.01JanuaryLCT ADNOC-101001/01/23 22:5005/01/23 22:300.210.130.461.840.710.300.21
3JanuaryLCT ADNOC-1010Waiting Cargo Operation & Berth (MOSB Base)Waitng ADNOC Berthing Instruction1.95.310.911.729.81.24JanuaryLCT ADNOC-101005/01/23 22:3009/01/23 06:500.340.422.010.670.210.25
4JanuaryLCT ADNOC-1010Waiting Cargo Operation & Berth (MOSB Base)Waiting Base Cargo Operation3.30.44.63.35.60.20.69.71138.71.61JanuaryLCT ADNOC-101009/01/23 06:5014/01/23 10:200.210.421.420.461.460.96
5JanuaryLCT ADNOC-1010Waiting Time at Offshore LcoationsWaitng Drilling Material00.00JanuaryLCT ADNOC-101014/01/23 10:2017/01/23 20:400.170.301.210.500.210.46
6JanuaryLCT ADNOC-1010Waiting Cargo Operation & Berth (MOSB Base)Cargo Operation Suspended6.35.311.60.48JanuaryLCT ADNOC-101017/01/23 20:4021/01/23 21:550.590.631.420.170.051.13
7JanuaryLCT ADNOC-1010Channel Waiting Time & VTS DelayWaiting VTS permission00.00JanuaryLCT ADNOC-101021/01/23 21:5525/01/23 01:350.880.541.750.590.17
8JanuaryLCT ADNOC-1010Channel Waiting Time & VTS DelayWaiting on Channel Closure5.95.90.25JanuaryLCT ADNOC-101025/01/23 01:3531/01/23 10:200.460.130.750.260.294.04
9JanuaryLCT ADNOC-1010Waiting On WeatherWaitinhg WOW , FOG / POOR VISIBILITY11.67.519.55.823.623.42420.3135.75.65JanuaryLCT ADNOC-101031/01/23 10:2004/02/23 02:050.460.050.42
10JanuaryLCT ADNOC-1010Total Steaming In Transit / Steaming to Location 4.64.77.88.41.511.93.90.41.312.52.412.53.83.30.40.63.78.30.592.53.85FebruaryLCT ADNOC-101004/02/23 02:0507/02/23 01:40
11JanuaryLCT ADNOC-1010Working Free PortFree-Port / Mus-Port00.00FebruaryLCT ADNOC-101007/02/23 01:4012/02/23 02:10
12JanuaryLCT ADNOC-1010Waiting on Free portStandby location ( Waiting )00.00FebruaryLCT ADNOC-101012/02/23 02:1015/02/23 18:45
13JanuaryLCT ADNOC-1010Waiting On WeatherWaitinhg WOW , FOG / POOR VISIBILITY00.00FebruaryLCT ADNOC-101015/02/23 18:4523/02/23 22:50
14JanuaryLCT ADNOC-1010Total SteamingIn Transit / Steaming to Location 00.00FebruaryLCT ADNOC-101023/02/23 22:5028/02/23 02:25
15JanuaryLCT ADNOC-1010Total Working Hours at Offshore LocationsAsseifiya Island0.42.457.80.33FebruaryLCT ADNOC-101028/02/23 02:2503/03/23 05:00
16JanuaryLCT ADNOC-1010Total Working Hours at Offshore LocationsEttouk Island5.96.42.72.417.40.73MarchLCT ADNOC-101003/03/23 05:0006/03/23 15:00
17JanuaryLCT ADNOC-1010Total Working Hours at Offshore LocationsAl Ghallan Island3.22.50.33.63.94.75.79.26.839.91.66MarchLCT ADNOC-101006/03/23 15:0011/03/23 12:50
18JanuaryLCT ADNOC-1010Total Working Hours at Offshore LocationsUmm Al Anbar4.95.88.619.30.80MarchLCT ADNOC-101011/03/23 12:5015/03/23 19:55
19JanuaryLCT ADNOC-1010Total Working Hours at Offshore LocationsAl Qatia Island00.00MarchLCT ADNOC-101015/03/23 19:5519/03/23 14:55
20JanuaryLCT ADNOC-1010Total Working Hours at Offshore LocationsBu Sikeen Island00.00MarchLCT ADNOC-101019/03/23 14:5525/03/23 02:10
21JanuaryLCT ADNOC-1010Working Others Marine Supply Others Supply of Vessel (WO/DO)00.00MarchLCT ADNOC-101025/03/23 02:1029/03/23 10:10
22JanuaryLCT ADNOC-1010Waiting Time at Offshore LcoationsStandby waiting Instruction00.00MarchLCT ADNOC-101029/03/23 10:1007/04/23 05:25
23JanuaryLCT ADNOC-1010Waiting Time at Offshore LcoationsWaitinhg Cargo Operation3.61.13.11.71.71.90.32410.30.60.25.31.81.81.70.57.166.72.78AprilLCT ADNOC-101007/04/23 05:2509/04/23 16:25
24JanuaryLCT ADNOC-1010Waiting On WeatherWaitinhg WOW , FOG / POOR VISIBILITY5.76.19.314.135.21.47AprilLCT ADNOC-101009/04/23 16:2513/04/23 08:20
25JanuaryLCT ADNOC-1010Total SteamingIn Transit / Steaming to Location 13.710.815.611.910.613.814.15.16.910.36.211.54.814.40.68.81.810.3171.27.13AprilLCT ADNOC-101013/04/23 08:2019/04/23 17:40
Sheet1 (2)
Cell Formulas
RangeFormula
AJ2:AJ25AJ2=SUM(E2:AI2)
AK2:AK25AK2=AJ2/24
AL2:AL23AL2=IFERROR(EOMONTH(AN2,-1)+1,"")
AL25AL25=IFERROR(EOMONTH(AN24,-1)+1,"")
 
Upvote 0
dont use the equal to for AO cell
=IFERROR(1/(1/SUMPRODUCT(($E$2:$AI$1728)*($A$2:$A$1728=$AL2)*($B$2:$B$1728=$AM2)*($C$2:$C$1728=AP$1)*($E$1:$AI$1>=DAY($AN2))*(($E$1:$AI$1<=DAY($AO2))))),"")
change to
=IFERROR(1/(1/SUMPRODUCT(($E$2:$AI$1728)*($A$2:$A$1728=$AL2)*($B$2:$B$1728=$AM2)*($C$2:$C$1728=AP$1)*($E$1:$AI$1>=DAY($AN2))*(($E$1:$AI$1<DAY($AO2))))),"")

For example, Column=AN has the date of 1/01/2023 and Column=AO is 05/01/2023 is the original date range, but to get and capture the right statistics, I need to minus one day from the return day
Now instead of , in the example , < or = 5
it will just be < 5
so 1 to 4 in that case
 
Upvote 0
dont use the equal to for AO cell
=IFERROR(1/(1/SUMPRODUCT(($E$2:$AI$1728)*($A$2:$A$1728=$AL2)*($B$2:$B$1728=$AM2)*($C$2:$C$1728=AP$1)*($E$1:$AI$1>=DAY($AN2))*(($E$1:$AI$1<=DAY($AO2))))),"")
change to
=IFERROR(1/(1/SUMPRODUCT(($E$2:$AI$1728)*($A$2:$A$1728=$AL2)*($B$2:$B$1728=$AM2)*($C$2:$C$1728=AP$1)*($E$1:$AI$1>=DAY($AN2))*(($E$1:$AI$1<DAY($AO2))))),"")


Now instead of, in the example, < or = 5
it will just be < 5
so 1 to 4 in that case
Dear Etaf

Thank you, I did the same but I noticed dates 31/01/2023 to 04/01/2023 didn't pick any entry since is <, I believed it should pick the only entry for 31/01/2023

is there a means to get the last date after updating the formula 31/01/2023 not picking

Appreciate your help if anything can be done to have picked anytime is return date moved to the following month

Regards
 
Upvote 0
no it will not pick up 31st as its not between the number 1 and 4
the formula is not looking at dates , as DAY , just changes to a number and so the formula part
*($E$1:$AI$1>=DAY($AN2))*(($E$1:$AI$1<DAY($AO2))))),"")
is JUST a number between AN2 and AO2

and so to capture those dates will need a rewrite of the formula

I probably need examples of how it would work NOW with dates ...... and NOT numbers ( DAYS() )
 
Upvote 0
no it will not pick up 31st as its not between the number 1 and 4
the formula is not looking at dates , as DAY , just changes to a number and so the formula part
*($E$1:$AI$1>=DAY($AN2))*(($E$1:$AI$1<DAY($AO2))))),"")
is JUST a number between AN2 and AO2

and so to capture those dates will need a rewrite of the formula

I probably need examples of how it would work NOW with dates ...... and NOT numbers ( DAYS() )
Good Day Etaf
Thanks for the quick response and I appreciate you looking into this for me, however, Please assist with a better option if it needs you to make some changes in the sheet.

Please if it requires me to change the day range from column E to AI to Date format I am willing to do that if that will get it worked out.

and if you have a better solution to work on the sheet sent previously I would appreciate that would be the best option for me.

i really appreciate all effort and help

Thanks
 
Upvote 0
you seem to be using a different formula now

=IFERROR(1/(1/SUMPRODUCT(($E$2:$AI$1728)*($A$2:$A$1728=$AL2)*($B$2:$B$1728=$AM2)*($C$2:$C$1728=AP$1)*($E$1:$AI$1>=DAY($AN2))*(($E$1:$AI$1<=DAY($AO2))))),"")

add up the values in
$E$2:$AI$1728 which comes to - 451.6
but only if
column a = al2 = 1st jan 23
=SUMPRODUCT((E2:AI17)*(A2:A17=AL2))
which a2 to a17 is - so stll 451.6

=SUMPRODUCT((E2:AI17)*(A2:A17=AL2)*($B$2:$B$17=$AM2))
now only if b has am2
LCT ADNOC-1010
they all do - so stll 451.6

next column c = ap1
Channel Waiting Time & VTS Delay
so now result is 5.9

next
$E$1:$AI$1>=DAY($AN2))*(($E$1:$AI$1<=DAY($AO2))))),
day an2 = 1
day ao2 = 5
still 5.9 , as that intered for day 2
so still 5.9

1/1/5.9
=
0.169491525

not sure on question
if i change an2 - so its the 2nd and also ao2 to 2nd
still works

Book3
ABCDEFGHIJKLMNOPQRSTUVWXYZAAABACADAEAFAGAHAIAJAKALAMANAOAPAQARASATAUAVAWAXAYAZBA
1Vessel NamesCriOperational Month & Date12345678910111213141516171819202122232425262728293031Total / HrsIn DaysVessel NameeStart Date & Time (Arrival Time at MOSB)Return to MOSB Date & TimeChannel Waiting Time & VTS DelayWaiting Cargo Operation & Berth (MOSB Base)Work Time at MOSBTotal SteamingInfield SteamingTotal Working Hours at Offshore LocationsWorking Others Marine Supply Waiting Time at Offshore LcoationsWaiting Daylight ComplexWaiting On WeatherMaintenance Days
21/1/23LCT ADNOC-1010Work Time at MOSBADNOC Base Jetty Cargo Operation0.810.20.79.910.37.60.310.53.21.511.93.91.572.33.0125Sunday 1 January 2023LCT ADNOC-1010Monday 2 January 2023Monday 2 January 20230.2458333330.13750.4250.191666667       0.169491525
Sheet1
Cell Formulas
RangeFormula
AJ2AJ2=SUM(E2:AI2)
AK2AK2=AJ2/24
AL2AL2=IFERROR(EOMONTH(AN2,-1)+1,"")
AP2:AZ2AP2=IFERROR(1/(1/SUMPRODUCT(($E$2:$AI$1728)*($A$2:$A$1728=$AL2)*($B$2:$B$1728=$AM2)*($C$2:$C$1728=AP$1)*($E$1:$AI$1>=DAY($AN2))*(($E$1:$AI$1<=DAY($AO2)))))/24,"")
BA2BA2=1/1/(SUMPRODUCT((E2:AI17)*(A2:A17=AL2)*($B$2:$B$17=$AM2)*($C$2:$C$17=AP$1)*($E$1:$AI$1>=DAY($AN2))*(($E$1:$AI$1<=DAY($AO2)))))




Dear Etaf

Hope you all is well and i hope you got my last email

Regards
 
Upvote 0
i saw the request , quite a different aproach maybe needed, but not 100% on how you receive the data and what the aim is

as you can see the limitation of using days in E to AI
but i dont know where this data comes from
if its say a month 1st march - 31st march
changing to a date - wont help goback to say beween the 28th Feb abd 3rd march as previous month will not be there

hence i'm not 100% sure what you are doing an how dates will help

if you want the sum between day1 and day 5 - that will work
But if before day1 - then its not in the file
and how far back before day 1
 
Upvote 0

Forum statistics

Threads
1,223,888
Messages
6,175,212
Members
452,618
Latest member
Tam84

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