Help with IF Formula for my Data.

Lukma

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

I need a Assistance with a new task and i have my data set in the way but i need a formula in Column S for the KPI criteria to subtract from my total hours Column R
Three Criteria is set for Percentage that mean
IF Criteria-1 Rigs&Barges ≥ 70% and the total hours is greater than 20:00 then i need to subtract 20Hrs from the total Hrs. in Column R
IF Criteria-2 Rigs&Barge <70% and total hours is greater than 14:00 then i need to subtract 14:00 from the total hours. in column R
Last Criteria-3 is Complex is greater than 12:00 in Column R then formula to subtract 12:00 from the total hours.

I have some Example of what i need the formula result in Column S

Appreciate all support to have this easy for my extraction.

Regards

Cell Formulas
RangeFormula
O16:O37,O5:O14O5=IFERROR(VLOOKUP(P5,'Total Location Serving'!$D$3:$E$100,2,0),"")
P5P5=IF(COUNTIFS(G5:$G$5,G5,E5:$E$5,E5)=1,G5,"")
P16:P37,P6:P14P6=IF(COUNTIFS(G$5:$G6,G6,E$5:$E6,E6)=1,G6,"")
R5,R16:R37,R10:R14,R7:R8R5=IF(P5="","",SUMIFS($K$5:$K$59996,$I$5:$I$59996,I5,$E$5:$E$59996,E5))
Q7,Q10:Q37Q7=IFERROR(VLOOKUP(C7,'[Vessels Actual Loadable Deck Space m2 (2023).xlsx]Vessel Location Deck M2'!$A$2:$J$5270,10,0),"")
 

Excel Facts

Square and cube roots
The =SQRT(25) is a square root. For a cube root, use =125^(1/3). For a fourth root, use =625^(1/4).
Hi, I couldn't exactly replicate your data.

When uing Excel 2019 - try S5, when using Excel 2016 - try S6.

Book1
S
4KPI Exceeded Hrs
50
60,041666667
Sheet1
Cell Formulas
RangeFormula
S5S5=SWITCH(TRUE(),AND(O5="Rigs&Barges",Q5>=0.7,R5>TIME(20,0,0)),R5-TIME(20,0,0),AND(O5="Rigs&Barges",Q5<0.7,R5>TIME(14,0,0)),R5-TIME(14,0,0),AND(O5="Complex",R5>TIME(12,0,0)),R5-TIME(12,0,0),0)
S6S6=IF(O6="Rigs&Barges", IF(Q6>=0.7, IF(R6>TIME(20,0,0), R6-TIME(20,0,0),0), IF(R6>TIME(14,0,0), R6-TIME(14,0,0),0)), IF(AND(O6="Complex",R6>TIME(12,0,0)),R6-TIME(12,0,0),0))
 
Upvote 0
Jorismoerings

Thanks so much for your support, after trying with formula in column T & U which you advised, and i have also tried with little of my knowledge but still i really dont know where problem is laying in the formula and reason am not getting the result

In my data you will see below in my data sheet result in meant to be 0.50 but am getting 0:0 but i really don't where the problem is laying

Appreciate if your support.

REgards

Rigs&BargesRig SMS Essa0%14:500:00:0



ILSP_Offshore Vessel Time Spent Tracking 2023.xlsx
OPQRSTU
5KPI CriteriaLocationDeck % Loaded Per VoyageTotal Spent Hrs Per VoyageKPI Exceeded Hrsformula 1Formula 2
6Rigs&BargesRig Mehzem0%10:0 0:00:0
7Rigs&BargesRig Al Noof0%10:0 0:00:0
8  0%  0:00:0
9Rigs&BargesRig SMS Essa0%14:50 0:00:0
10Rigs&BargesRig Yemillah0%1:50 0:00:0
11Rigs&BargesBarge Lulwa0%6:30 0:00:0
12IslandBu Sikeen Island0%0:18 0:00:0
13  0%  0:00:0
14IslandAl Qatia Island0%0:12 0:00:0
ILSP Offshore Vessel Tracking
Cell Formulas
RangeFormula
O6:O14O6=IFERROR(VLOOKUP(P6,'Total Location Serving'!$D$3:$E$100,2,0),"")
P6P6=IF(COUNTIFS(G6:$G$6,G6,E6:$E$6,E6)=1,G6,"")
Q6:Q14Q6=IFERROR(VLOOKUP(C6,'[Vessels Actual Loadable Deck Space m2 (2023).xlsx]Vessel Location Deck M2'!$A$2:$J$5270,10,0),"0%")
R6:R14R6=IF(P6="","",SUMIFS($K$6:$K$59997,$I$6:$I$59997,I6,$E$6:$E$59997,E6))
S6:S10S6=IF(AND(O6=$O$2,Q6=$Q$2,R6>=$P$2),R6-$P$2,IF(AND(O6=$O$3,Q6<$Q$2,R6>$P$3),R6-$P$3,IF(AND(O6=$O$4,R6>$P$4),R6-$P$4,"")))
T6:T14T6=SWITCH(TRUE(),AND(O6="Rigs&Barges",Q6>=$Q$2,R6>TIME(20,0,0)),R6-TIME(20,0,0),AND(O6="Rigs&Barges",Q6<$Q$3,R6>TIME(14,0,0)),R6-TIME(14,0,0),AND(O6="Complex",R6>TIME(12,0,0)),R6-TIME(12,0,0),0)
U6:U14U6=IF(O6="Rigs&Barges", IF(Q6>=0.7,IF(R6>TIME(20,0,0), R6-TIME(20,0,0),0),IF(R6>TIME(14,0,0), R6-TIME(14,0,0),0)),IF(AND(O6="Complex",R6>TIME(12,0,0)),R6-TIME(12,0,0),0))
P7:P14P7=IF(COUNTIFS(G$6:$G7,G7,E$6:$E7,E7)=1,G7,"")
S11:S14S11=IF(AND(O11=$O$2,Q11=$Q$2,R11>$P$2),R11-$P$2,IF(AND(O11=$O$3,Q11<$Q$2,R11>$P$3),R11-$P$3,IF(AND(O11=$O$4,R11>$P$4),R11-$P$4,"")))
 
Upvote 0
Hi,

I can't replicate your outcome because i can't see what's in the cells your not sharing (anything above row 5) however:
Book1
OPQRSTU
270%
370%
4
5KPI CriteriaLocationDeck % Loaded Per VoyageTotal Spent Hrs Per VoyageKPI Exceeded Hrsformula 1Formula 2
6Rigs&Barges0%14:50:0000:50:0000:50:00
700:50:0000:50:00
Sheet1
Cell Formulas
RangeFormula
T6T6=SWITCH(TRUE(),AND(O6="Rigs&Barges",Q6>=$Q$2,R6>TIME(20,0,0)),R6-TIME(20,0,0),AND(O6="Rigs&Barges",Q6<$Q$3,R6>TIME(14,0,0)),R6-TIME(14,0,0),AND(O6="Complex",R6>TIME(12,0,0)),R6-TIME(12,0,0),0)
U6U6=IF(O6="Rigs&Barges", IF(Q6>=0.7,IF(R6>TIME(20,0,0), R6-TIME(20,0,0),0),IF(R6>TIME(14,0,0), R6-TIME(14,0,0),0)),IF(AND(O6="Complex",R6>TIME(12,0,0)),R6-TIME(12,0,0),0))
T7T7=SWITCH(TRUE(),AND(O6="Rigs&Barges",Q6>=0.7,R6>TIME(20,0,0)),R6-TIME(20,0,0),AND(O6="Rigs&Barges",Q6<0.7,R6>TIME(14,0,0)),R6-TIME(14,0,0),AND(O6="Complex",R6>TIME(12,0,0)),R6-TIME(12,0,0),0)
U7U7=IF(O6="Rigs&Barges", IF(Q6>=0.7, IF(R6>TIME(20,0,0), R6-TIME(20,0,0),0), IF(R6>TIME(14,0,0), R6-TIME(14,0,0),0)), IF(AND(O6="Complex",R6>TIME(12,0,0)),R6-TIME(12,0,0),0))
 
Upvote 0
Solution
In my data you will see below in my data sheet result in meant to be 0.50 but am getting 0:0 but i really don't where the problem is laying
The formula2 @jorismoerings provided definitely works. However it is reliant on having a percent value that meets the criteria in Column Q.
In the Test data you posted in #3 you have all the % set to 0 which does not meet any of your criteria.
Change the 0% in Row 9 column Q to 65% per your first posting AND format the Formula 2 column as h:mm and you should get your 0:50.
 
Upvote 0
Hi Jorismoerings

Thanks and am not saying formula not working the forum as been major support to my work in office during issue so Alex please do not get me wrong.

However i was able to Add this to the Percentage in formula and am able to get the result, but please check if all is ok Please Jorismoerings

Appreciate always

Many Thanks

[=IF(O13817="Rigs&Barges", IF(Q13817="*>=0.7*",IF(R13817>TIME(20,0,0), R13817-TIME(20,0,0),0),IF(R13817>TIME(14,0,0), R13817-TIME(14,0,0),0)),IF(AND(O13817="Complex",R13817>TIME(12,0,0)),R13817-TIME(12,0,0),0))]
 
Upvote 0

Forum statistics

Threads
1,215,077
Messages
6,122,991
Members
449,094
Latest member
masterms

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