If and or function

melq64

New Member
Joined
Aug 21, 2017
Messages
49
Sample-data.JPG

Appreciate any help in advance:)

Having trouble coming up with a formula for column J (Time at Depot) to return number of days (rounded up) it takes for an item to get delivered based on the following scenario below:

using cell J2 as reference

IF I2="IMC", return C2

IF I2="AMC", return E2

IF I2="WNM" & A2="C4", H2-B2 OR IF I2="WNM" & A2="C6", H2-D2 [if B2 or D2 blank, return "no scan"]

IF I2="WKM", H2-D2

IF I2="AKL delivery", H2-D2

IF I2="CHC delivery", H2-F2 [if F2 blank, return "no scan"]

IF I2="TRG", H2-D2

IF I2="CHM", return G2 [if G2 blank, return "no scan"]


ABCDEFGHIJ
1ProductExit IMCTime at IMCExit AMCTime at AMCExit CHMTime at CHMDelivered DateDelay PointTime at Depot
2
C610-08-2017 11:22:00 AM21hrs10-08-2017 8:35:00 PM6hrs12-08-2017 5:50:00 AM12-08-2017IMC
3C606-08-2017 10:29:00 AM2days08-08-2017 4:23:00 AM2days10-08-2017AMC
4C609-08-2017 4:46:00 PM4hrs09-08-2017 8:30:00 PM2hrs11-08-2017WNM
5C410-08-2017 3:02:00 PM23hrs12-08-2017WNM
6C613-08-2017 1:06:00 PM2days14-08-2017 10:02:00 PM2days16-08-2017WKM
7C606-08-2017 1:06:00 PM3hrs08-08-2017 4:08:00 AM2days09-08-2017AKL delivery
8C407-08-2017 11:39:00 AM4hrs08-08-2017 5:50:00 AM7hrs09-08-2017CHC delivery
9C608-08-2017 10:54:00 AM22hrs08-08-2017 9:45:00 PM8hrs10-08-2017TRG
10C613-08-2017 11:03:00 AM2days14-08-2017 11:48:00 PM2days16-08-2017 6:02:00 AM21hrs17-08-2017CHM

<tbody>
</tbody>
 

Excel Facts

How to find 2nd largest value in a column?
MAX finds the largest value. =LARGE(A:A,2) will find the second largest. =SMALL(A:A,3) will find the third smallest
Try (untested)

=IF(I2="IMC",C2,IF(I2="AMC",E2,IF(I2="WNM",IF(A2="C4",IF(B2="","No Scan",H2-B2),IF(A2="C6",IF(D2="","No Scan",H2-D2),IF(I2="WKM",H2-D2,IF(I2="AKL delivery",H2-D2,IF(I2="CHC delivery",IF(F2="","No Scan",H2-F2),IF(I2="TRG",H2-D2,IF(I2="CHM",IF(G2="","No Scan",G2)))))))))))
 
Upvote 0
=IF( I2="IMC", C2, IF( I2="AMC", E2,IF(and( I2="WNM" ,A2="C4"), H2-B2 , IF(and( I2="WNM" , A2="C6"), H2-D2 ,if(or( B2="", D2=""), "no scan",IF (I2="WKM", H2-D2, IF( I2="AKL delivery", H2-D2, IF (I2="CHC delivery", H2-F2 ,if( F2 ="", "no scan",IF (I2="TRG", H2-D2,IF (I2="CHM", if( G2 ="","no scan",G2))))))))))))

this is the approach but need more info on if F2 is blank because F2 is called before that, same with G2
 
Upvote 0
Thanks Special-K99 but I'm getting a FALSE value.

However, am getting correct values for the part of the function where it says return associated value of corresponding cell e.g. IF(I2="IMC",C2)

Any suggestions on how to amend the FALSE values?
 
Upvote 0
Thanks oldbrewer but am getting error message with function "There's a problem with this formula"

What further info are you after regarding F2 & G2?
 
Upvote 0
you use them in your formula before saying if they are blank then return no scan

do you want F2 and G2 checked if blank at the beginning - IF (I2="CHC delivery", H2-F2 ,if( F2 ="", "no scan",IF.....makes no sense

the formula needs checking for equal numbers of brackets etc - I was giving you a steer
 
Upvote 0
IF I2="IMC", return C2
IF I2="AMC", return E2
IF I2="WNM" & A2="C4", H2-B2 OR IF I2="WNM" & A2="C6", H2-D2 [if B2 or D2 blank, return "no scan"]
IF I2="WKM", H2-D2
IF I2="AKL delivery", H2-D2
IF I2="CHC delivery", H2-F2 [if F2 blank, return "no scan"]
IF I2="TRG", H2-D2
IF I2="CHM", return G2 [if G2 blank, return "no scan"]
is my interpretation below correct ?
imcc2
amce2
wnm and a2="C4"h2-b2but if b2= blank "no scan"
wnm and a2="C6"h2-d2but if d2=blank "no scan
chc deliveryf2-f2but if f2 = blank "no scan"
chmg2but if g2 = blank "no scan"
otherwise
wkm
akl deliveryh2-d2DO YOU WANT D2 CHECKED FOR BLANKNESS HERE AS WELL
trg

<colgroup><col span="14"></colgroup><tbody>
</tbody>
 
Upvote 0
Apologies now I understand.

Yes that's correct except for chc delivery f2-f2, should be h2-f2

And yes check D2 for blank

Sorry just realized that E2 & C2 need to be checked for blanks as well i.e. if blank return "no scan"
 
Upvote 0

Forum statistics

Threads
1,215,006
Messages
6,122,665
Members
449,091
Latest member
peppernaut

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