How to get a specific result using IF formula based on multiple conditions?

rizwanulhasan

New Member
Joined
Jan 1, 2022
Messages
16
Office Version
  1. 2021
Platform
  1. Windows
Hi,

Hope all are well.

My requirements are as follows:

C53 should show as DRF COMPLETE if the below conditions are fulfilled.

1. C5 to C10, C14, C32, C40, C43, C44, C46, C47 should not be blank

2. C8 should always be a number of 14 digits

3. Only if C6=USA, C11 should not be blank.

4. Only if C14="Partial Batch Decommissioning",

i> C20 should not be blank and C55 should be "QUANTITY MATCH"

ii> If C20 = SGTIN Level - B28 should not be blank and should contain a numerical value. Similarly for below:

Case Level - B28 & C28
Pallet Level - B28 & D28
Cases + Pallets - C28 & D28
SGTIN + Cases - B28 & C28
SGTIN + Pallets - B28 & D28
SGTIN + Cases + Pallets - B28, C28 & D28

I am using below formula. Everything's perfect, just that 1 condition doesn't work. When C14=Partial Batch Decommissioning, despite C55=QUANTITY MISMATCH, C53 shows DRF COMPLETE whereas it should show DRF INCOMPLETE.

Excel Formula:
="DRF"&IF(AND(AND(COUNTA(C5:C10)=6,C14<>"",C32<>"",C40<>"",COUNTA(C43,C44,C46,C47)=4),AND(LEN(C8)=14,ISNUMBER(C8+0),IF(C6="USA",C11<>"",TRUE),IF(C14="Partial Batch Decommissioning",AND(C20<>"",TRUE),C55="QUANTITY MATCH"),AND(OR(AND(C20="SGTIN Level",B28<>""),AND(C20="Case Level",COUNT(B28:C28)=2),AND(C20="Pallet Level",COUNT(B28,D28)=2),AND(C20="SGTIN + Cases",COUNT(B28,C28)=2),AND(C20="Cases + Pallets",COUNT(C28,D28)=2),AND(C20="SGTIN + Pallets",COUNT(B28,D28)=2),AND(C20="SGTIN + Cases + Pallets",COUNT(B28:D28)=3))))), " COMPLETE"," INCOMPLETE")

Note: This is a cross post and the link to original post is as below.

How to get a specific result using IF formula based on multiple conditions?
 
Last edited by a moderator:

Excel Facts

Wildcard in VLOOKUP
Use =VLOOKUP("Apple*" to find apple, Apple, or applesauce
Check this and revert -

Excel Formula:
="DRF"&IFS(AND(COUNTIFS(C5:C10,"<>")=0,C14<>"",C32<>"",C40<>"",C43<>"",C44<>"",C46<>"",C47<>"",ISNUMBER(C8),LEN(C8)=14,AND(C6="USA",C11=""),AND(C14="Partial Batch Decommissioning",OR(AND(C20<>"",C55="QUANTITY MATCH"),AND(C20="SGTIN Level",B28<>""),AND(C20="Case Level",B28<>"",C28<>""),AND(C20="Pallet Level",B28<>"",D28<>""),AND(C20="Cases + Pallets",C28<>"",D28<>""),AND(C20="SGTIN + Cases",B28<>"",C28<>""),AND(C20="SGTIN + Pallets",B28<>"",D28<>""),AND(C20="SGTIN + Cases + Pallets",B28<>"",C28<>"",D28<>""))))," COMPLETE",TRUE," INCOMPLETE")
 
Upvote 0
I think it should be modified as below -

Excel Formula:
="DRF"&IFS(AND(COUNTIFS(C5:C10,"<>")=6,C14<>"",C32<>"",C40<>"",C43<>"",C44<>"",C46<>"",C47<>"",ISNUMBER(C8),LEN(C8)=14,AND(C6="USA",C11=""),AND(C14="Partial Batch Decommissioning",OR(AND(C20<>"",C55="QUANTITY MATCH"),AND(C20="SGTIN Level",B28<>""),AND(C20="Case Level",B28<>"",C28<>""),AND(C20="Pallet Level",B28<>"",D28<>""),AND(C20="Cases + Pallets",C28<>"",D28<>""),AND(C20="SGTIN + Cases",B28<>"",C28<>""),AND(C20="SGTIN + Pallets",B28<>"",D28<>""),AND(C20="SGTIN + Cases + Pallets",B28<>"",C28<>"",D28<>""))))," COMPLETE",TRUE," INCOMPLETE")
 
Upvote 0
Hi Sanjay,

Many thanks for your response.

I tried both formulae but they doesn't work. Was just wondering how to upload workbook to the post.
 
Upvote 0
Hi Sanjay,

Many thanks for your response.

I tried both formulae but they doesn't work. Was just wondering how to upload workbook to the post.
You can't upload workbook here in this forum

You can upload XL2BB here that is quite helpful.
 
Upvote 0
I tried both formulae but they doesn't work
Just now I tested it for all conditions one by one. It is working.

Check this and revert -

Book2
ABCD
1DRF COMPLETE
2DRF COMPLETE
3
4
5A
6USA
7A
81.23457E+13
9A
10A
11
12
13
14Partial Batch Decommissioning
15
16
17
18
19
20SGTIN + Cases
21
22
23
24
25
26
27
28AAA
29
30
31
32A
33
34
35
36
37
38
39
40A
41
42
43A
44A
45
46A
47A
48
49
50
51
52
53
54
55
Sheet1
Cell Formulas
RangeFormula
A1A1="DRF"&IFS(AND(COUNTIFS(C5:C10,"<>")=6,C14<>"",C32<>"",C40<>"",C43<>"",C44<>"",C46<>"",C47<>"",ISNUMBER(C8),LEN(C8)=14,AND(C6="USA",C11=""),AND(C14="Partial Batch Decommissioning",OR(AND(C20<>"",C55="QUANTITY MATCH"),AND(C20="SGTIN Level",B28<>""),AND(C20="Case Level",B28<>"",C28<>""),AND(C20="Pallet Level",B28<>"",D28<>""),AND(C20="Cases + Pallets",C28<>"",D28<>""),AND(C20="SGTIN + Cases",B28<>"",C28<>""),AND(C20="SGTIN + Pallets",B28<>"",D28<>""),AND(C20="SGTIN + Cases + Pallets",B28<>"",C28<>"",D28<>""))))," COMPLETE",TRUE," INCOMPLETE")
A2A2="DRF"&IFS(AND(TRUE,TRUE,TRUE,TRUE,TRUE,TRUE,TRUE,TRUE,TRUE,TRUE,TRUE,AND(C14="Partial Batch Decommissioning",OR(AND(C20<>"",C55="QUANTITY MATCH"),AND(C20="SGTIN Level",B28<>""),AND(C20="Case Level",B28<>"",C28<>""),AND(C20="Pallet Level",B28<>"",D28<>""),AND(C20="Cases + Pallets",C28<>"",D28<>""),AND(C20="SGTIN + Cases",B28<>"",C28<>""),AND(C20="SGTIN + Pallets",B28<>"",D28<>""),AND(C20="SGTIN + Cases + Pallets",B28<>"",C28<>"",D28<>""))))," COMPLETE",TRUE," INCOMPLETE")
 
Upvote 0
3. Only if C6=USA, C11 should not be blank.
For this condition I have made a minor modification in the formula. Check this and revert -

Excel Formula:
="DRF"&IFS(AND(COUNTIFS(C5:C10,"<>")=6,C14<>"",C32<>"",C40<>"",C43<>"",C44<>"",C46<>"",C47<>"",ISNUMBER(C8),LEN(C8)=14,AND(C6="USA",C11=""),AND(C14="Partial Batch Decommissioning",OR(AND(C20<>"",C55="QUANTITY MATCH"),AND(C20="SGTIN Level",B28<>""),AND(C20="Case Level",B28<>"",C28<>""),AND(C20="Pallet Level",B28<>"",D28<>""),AND(C20="Cases + Pallets",C28<>"",D28<>""),AND(C20="SGTIN + Cases",B28<>"",C28<>""),AND(C20="SGTIN + Pallets",B28<>"",D28<>""),AND(C20="SGTIN + Cases + Pallets",B28<>"",C28<>"",D28<>""))))," COMPLETE",TRUE," INCOMPLETE")

There are so many conditions to test some confusion or error can remain, that only you can test or verify as per your needs.
 
Last edited:
Upvote 0
Unfortunately, not working. Sheet contains data validations because of which i am unable to upload XL2BB as well.
 
Upvote 0
Form-1.xlsx
ABCD
1
2
3
4To Be Completed by RequestorDecommissioning ProductEnter Product Details
5Supply Site / Market Warehouse / LOCa
6GTIN MarketUSA
7Batch / Lot Numbera
8GTIN (Global Trade Item Number)05054290000931
9Trade Item Descriptiona
10SKU / Material Numbera
11Case GTIN (for US Market Only)DRF INCOMPLETE
12
13Types of DecommissioningChoose Type of Decommissioning
14Full Batch Decommissioning with ReworkPartial Batch Decommissioning
15Full Batch Decommissioning without Rework
16Partial Batch Decommissioning
17
18Scroll down for more inputs
19Levels of DecommissioningChoose Level of Decommissioning
20SGTIN LevelSGTIN Level
21Case Level
22Pallet Level
23Cases + Pallets
24SGTIN + Cases
25SGTIN + Pallets
26SGTIN + Cases + Pallets
27Enter SGTIN QuantityEnter Case QuantityEnter Pallet Quantity
28211
29NoteEnter SGTIN quantity. Also ensure that the same count of SGTINs are listed at the end of this form.
30
31Decommissioning Reason CodesChoose Reason Code for Decommissioning
32FREE SAMPLESAMPLE
33SAMPLE
34DESTROYED
35SUPPLIED
36EXPORTED
37OTHERS
38LOCKED
39RECALL
40Decommissioning Comments (if any)N/A
41
42Data ProviderEnter DetailsDescription of Role
43MUDIDa
44Name a
45Quality Approver Enter DetailsDescription of Role
46MUDIDa
47Name a
48
49SUMMARY Partial Batch Decommissioning for batch a associated with GTIN 05054290000931 using reason code SAMPLE
50
51
52
53DRF Completion Status (For details, refer row 20 in Instructions sheet)DRF INCOMPLETE
54
55To Be Completed by RequestorQuantity Verification: (For details, refer row 23 in Instructions sheet)QUANTITY MIS-MATCH
56Quantity of Serial Number/SGTINs EnteredQuantity of Cases EnteredQuantity of Pallets Entered
57111
58Enter Serial numbers / SGTINs to be decommissioned Enter Case numbers (SGTINs / SSCCs) to be decommissioned Enter Pallet numbers (SSCCs) to be decommissioned
59000000000000010000000000000100000000000001
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
Decommissioning Request Form
Cell Formulas
RangeFormula
C29C29=IF(C20="","",IF(C20="SGTIN Level","Enter SGTIN quantity. Also ensure that the same count of SGTINs are listed at the end of this form.",IF(C20="Case Level","Enter total SGTIN quantity of the case and Case quantity. Also ensure that the same count of case numbers are listed at the end of this form.",IF(C20="Pallet Level","Enter total SGTIN quantity of the pallet and Pallet quantity. Also ensure that the same count of pallet numbers are listed at the end of this form.",IF(C20="Cases + Pallets","Enter total number of Cases in the pallet and Pallet quantity. Also ensure that the same count of cases and pallet numbers are listed at the end of this form.",IF(C20="SGTIN + Cases","Enter both SGTIN and Case quantity. Also ensure that the same count of SGTINs and case numbers are listed at the end of this form.",IF(C20="SGTIN + Pallets","Enter both SGTIN and Pallet quantity. Also ensure that the same count of SGTINs and pallet numbers are listed at the end of this form.",IF(C20="SGTIN + Cases + Pallets","Enter SGTINs, Cases and Pallets quantity. Also ensure that the same count of SGTINs, Cases and Pallet numbers are listed at the end of this form."))))))))
C49C49=" "&$C$14&" for batch "&$C$7&" associated with GTIN "&$C$8&" using reason code "&$C$32
C53C53="DRF"&IFS(AND(COUNTIFS(C5:C10,"<>")=6,C14<>"",C32<>"",C40<>"",C43<>"",C44<>"",C46<>"",C47<>"",ISNUMBER(C8),LEN(C8)=14,IF(C6="USA",C11<>"",TRUE),AND(C14="Partial Batch Decommissioning",OR(AND(C20<>"",C55="QUANTITY MATCH"),AND(C20="SGTIN Level",B28<>""),AND(C20="Case Level",B28<>"",C28<>""),AND(C20="Pallet Level",B28<>"",D28<>""),AND(C20="Cases + Pallets",C28<>"",D28<>""),AND(C20="SGTIN + Cases",B28<>"",C28<>""),AND(C20="SGTIN + Pallets",B28<>"",D28<>""),AND(C20="SGTIN + Cases + Pallets",B28<>"",C28<>"",D28<>""))))," COMPLETE",TRUE," INCOMPLETE")
C55C55=IF(C20="SGTIN Level",IF(B28="","ENTER SGTIN QUANTITY",IF(B28=B57,"QUANTITY MATCH","QUANTITY MIS-MATCH")),IF(C20="Case Level",IF(COUNT(B28,C28)<>2,"ENTER SGTIN & CASE QUANTITY",IF(C28=C57,"QUANTITY MATCH","QUANTITY MIS-MATCH")),IF(C20="Pallet Level",IF(COUNT(B28,D28)<>2,"ENTER SGTIN & PALLET QUANTITY",IF(D28=D57,"QUANTITY MATCH","QUANTITY MIS-MATCH")),IF(C20="Cases + Pallets",IF(COUNT(C28,D28)<>2,"ENTER CASE & PALLET QUANTITY",IF(AND(C28=C57,D28=D57),"QUANTITY MATCH","QUANTITY MIS-MATCH")),IF(C20="SGTIN + Cases",IF(COUNT(B28,C28)<>2,"ENTER SGTIN & CASE QUANTITY",IF(AND(B28=B57,C28=C57),"QUANTITY MATCH","QUANTITY MIS-MATCH")),IF(C20="SGTIN + Pallets",IF(COUNT(B28,D28)<>2,"ENTER SGTIN & PALLET QUANTITY",IF(AND(B28=B57,D28=D57),"QUANTITY MATCH","QUANTITY MIS-MATCH")),IF(C20="SGTIN + Cases + Pallets",IF(COUNT(B28,C28,D28)<>3,"ENTER SGTIN, CASE & PALLET QUANTITY",IF(AND(B28=B57,C28=C57,D28=D57),"QUANTITY MATCH","QUANTITY MIS-MATCH")))))))))
B57:D57B57=COUNTIF(B59:B1048576,"<>")
Cells with Conditional Formatting
CellConditionCell FormatStop If True
B19:D29Expression=$C$14<>"Partial Batch Decommissioning"textYES
A55:D95Expression=$C$14<>"Partial Batch Decommissioning"textNO
B27:D29Expression=$C$20=""textNO
C27:D27Expression=$C$20="SGTIN Level"textNO
C27Expression=$C$20="Pallet Level"textNO
A55:D95,A55:C55Expression=$C$20=""textNO
C18Expression=C14="Partial Batch Decommissioning"textNO
C28Expression=$C$20="Pallet Level"textNO
C28:D28Expression=$C$20="SGTIN Level"textNO
B56:B95Expression=(OR($C$20="Case Level"))textNO
C55Expression=OR(C55="ENTER SGTIN QUANTITY",C55="ENTER SGTIN & CASE QUANTITY",C55="ENTER SGTIN & PALLET QUANTITY",C55="ENTER CASE & PALLET QUANTITY",C55="ENTER SGTIN & CASE QUANTITY",C55="ENTER SGTIN & PALLET QUANTITY",C55="ENTER SGTIN, CASE & PALLET QUANTITY")textNO
B56:B95Expression=(OR($C$20="Pallet Level"))textNO
D27Expression=(OR($C$20="Case Level",$C$20="SGTIN + Cases"))textNO
B11:D11Expression=$C$6<>"USA"textNO
C53Expression=C53="DRF INCOMPLETE"textNO
C53Expression=C53="DRF COMPLETE"textNO
C55Expression=C55="QUANTITY MATCH"textNO
C55Expression=C55="QUANTITY MIS-MATCH"textNO
C27Expression=$C$20="SGTIN + Pallets"textNO
C28Expression=$C$20="SGTIN + Pallets"textNO
D28Expression=(OR($C$20="Case Level",$C$20="SGTIN + Cases"))textNO
B27,B56:B95Expression=(OR($C$20="Cases + Pallets"))textNO
B28Expression=(OR($C$20="Cases + Pallets"))textNO
C56:C95Expression=$C$20="SGTIN Level"textNO
C56:C95Expression=$C$20="Pallet Level"textNO
C56:C95Expression=$C$20="SGTIN + Pallets"textNO
D56:D95Expression=(OR($C$20="SGTIN Level",$C$20="Case Level",$C$20="SGTIN + Cases"))textNO
C49Expression=C47=""textNO
 
Upvote 0

Forum statistics

Threads
1,224,823
Messages
6,181,170
Members
453,021
Latest member
Justyna P

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