multiple if conditions to tag relevant records

nikhil0311

Board Regular
Joined
May 3, 2013
Messages
200
Office Version
  1. 2013
Platform
  1. Windows

Excel 2007
ABCDEFGH
1Include/ExcludeParent CASIDDateRegionProduct MappingStageStage 2Relevant (Y/N)
2IncludePrivate2015APACCCBidLost
3-2016CANLiqMandateDead
4TBD2017EMEAFXOppYes
52018LATAMLendLostNo
62020OthersPaymentechNQOProbably
72025USTradeClosed
82065Other
9IB
10Multiple Products
Sheet1




[TABLE="width: 83"]
<colgroup><col></colgroup><tbody>[TR]
[TD]If Column A. Include/Exclude = Include[/TD]
[/TR]
[TR]
[TD]AND

[/TD]
[/TR]
[TR]
[TD]Column B. Parent CASID <> "Private","-","TBD"
[/TD]
[/TR]
[TR]
[TD]
AND

[/TD]
[/TR]
[TR]
[TD]Column C. date >=2017
[/TD]
[/TR]
[TR]
[TD]
AND

[/TD]
[/TR]
[TR]
[TD]Column D. Region = "APAC,"CAN","EMEA","LATAM","US","Others"
[/TD]
[/TR]
[TR]
[TD]
AND
[/TD]
[/TR]
[TR]
[TD]
Column E. Product Mapping have 3 different conditions

[/TD]
[/TR]
[TR]
[TD]1 - if "Paymentech" then exclude
[/TD]
[/TR]
[TR]
[TD]2 - if Column D. i.e. Region is "US" or "Others" AND Column E.i.e. Product Mapping = "Trade" then Include as relevant
[/TD]
[/TR]
[TR]
[TD]3 - all remaining regions i.e."APAC", "CAN", "EMEA", "LATAM" with any products except "Paymentech" should be considered as relevant
[/TD]
[/TR]
[TR]
[TD]
AND

[/TD]
[/TR]
[TR]
[TD]Column F. Stage = "Bid", "Closed","Lost","Mandate","NQO","Opp"
[/TD]
[/TR]
[TR]
[TD]
AND

[/TD]
[/TR]
[TR]
[TD]If Column F i.e. Stage = "Lost" AND Column G i.e. Stage 2 = "Lost" then consider consider as relevant record
[/TD]
[/TR]
[TR]
[TD]all of the above conditions should be tagged as "Y" in Column H i.e. Relevant Y/N
[/TD]
[/TR]
</tbody>[/TABLE]
 

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.
@nikhil0311, I followed up until this:

_____________________________________

[TABLE="class: cms_table, width: 83"]
<tbody>[TR]
[TD]Column F. Stage = "Bid", "Closed","Lost","Mandate","NQO","Opp"[/TD]
[/TR]
[TR]
[TD]AND
[/TD]
[/TR]
[TR]
[TD]If Column F i.e. Stage = "Lost" AND Column G i.e. Stage 2 = "Lost" then consider consider as relevant record

_____________________________________[/TD]
[/TR]
</tbody>[/TABLE]

Are you saying count as relevant if all prior conditions have been met and Column F contains any of the blue words, regardless of what's in Column G, except only count Column F = "Lost" if Column G also = "Lost"?

What if Column F="Lost" and Column G is blank? Still relevant? Or not?

What if Column F="Lost" and Column G = "yes"? Not relevant?

Will Column G ever be filled if it's corresponding cell in Column F doesn't have "Fill"?

 
Upvote 0
@nikhil0311, It's not clear whether you're looking for a VBA solution or a formula-based solution. If you are looking for a formula-based solution, and given the example in your original post, enter the following formula into cell H2 and drag-copy down as far as needed:

Code:
=IF(AND(TRIM(UPPER(A2))="INCLUDE",OR(TRIM(B2)="",ISERROR(SEARCH(TRIM(B2),"Private-TBD"))),C2>=2017,AND(TRIM(D2)<>"",ISNUMBER(SEARCH(TRIM(D2),"APAC-CAN-EMEA-LATAM-US-Others"))),TRIM(E2)<>"PAYMENTECH",IF(ISNUMBER(SEARCH(TRIM(D2),"US-Others")),IF(UPPER(E2)="TRADE",TRUE,FALSE),TRUE),AND(TRIM(F2)<>"",ISNUMBER(SEARCH(TRIM(F2),"Bid-Closed-Lost-Mandate-NQO-Opp"))),IF(TRIM(UPPER(F2))="LOST",IF(TRIM(UPPER(G2))="LOST",TRUE,FALSE),TRUE)),"Y","N")

I'm fairly sure I covered all the bases, at least as I understood them.
 
Upvote 0
Are you saying count as relevant if all prior conditions have been met and Column F contains any of the blue words, regardless of what's in Column G, except only count Column F = "Lost" if Column G also = "Lost"? - YES

What if Column F="Lost" and Column G is blank? Still relevant? Or not? - - Not Relevant

What if Column F="Lost" and Column G = "yes"? Not relevant? - Not Relevant

Will Column G ever be filled if it's corresponding cell in Column F doesn't have "Fill"? - Column G is only considered to fulfill if F = Lost and G is also lost.
 
Upvote 0
Hi Erik, I need a Formula. Also would it be possible to use values from specific range instead of hard-coding?
 
Upvote 0
@nikhil0311, I'm not sure I understand your question above. The general answer is, yes, you can change the cell references in my formula to reflect the actual cell references in your own sheet. Beyond that, you'll have to be more specific.
 
Upvote 0
for instance, column B have "-", "TBD" and "private" values. their might be a possibility in the near future it will have new values. In that case I will have to manually update the formula every time whenever there is a new value. so is it possible to automate this?
 
Upvote 0
Hi Erik, Thanks a lot for your help. Your Formula is working perfectly fine. I have a small change. In Column F i.e. Stage I want to exclude "-" records. can you please let me know how to achieve this?
 
Upvote 0
@nikhil0311, here is the most flexible modification, per your above specification:
Code:
=IF(AND(TRIM(UPPER(A2))="INCLUDE",OR(TRIM(B2)="",ISERROR(SEARCH(TRIM(B2),"Private-TBD"))),C2>=2017,AND(TRIM(D2)<>"",ISNUMBER(SEARCH(TRIM(D2),"APAC-CAN-EMEA-LATAM-US-Others"))),TRIM(E2)<>"PAYMENTECH",IF(ISNUMBER(SEARCH(TRIM(D2),"US-Others")),IF(UPPER(E2)="TRADE",TRUE,FALSE),TRUE),AND(TRIM(F2)<>"",ISNUMBER(SEARCH(TRIM(F2),"Bid-Closed-Lost-Mandate-NQO-Opp"))),TRIM(F2)<>"-",IF(TRIM(UPPER(F2))="LOST",IF(TRIM(UPPER(G2))="LOST",TRUE,FALSE),TRUE)),"Y","N")

I sent you a PM as well.
 
Upvote 0

Forum statistics

Threads
1,224,823
Messages
6,181,177
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