May 28 2020 02:37 PM
We have a range where each categories has notes.
Please find the below condition where 1, 2 are the volumes.
CM- Account Credit (contl) category should be 1-Credit or 2-hold or 1-rejected and it has to throw error if the notes are not matching.
Category | Notes |
CM- Account Credit (contl) | 1-Credit or 1-hold or 1-rejected |
CM - Account Transfer (contl) | 2-transfer or 2- rejected |
CM - Account Closed (util) | Closed, Dormant |
May 28 2020 04:33 PM
@resham1985 you can use "Data Validation" and choose "custom" and enter a formula like the following assuming B is category and C is note and you start validation in row 2:
=OR(AND(B2="category 1",OR(C2="comment 1",C2="comment 2",C2="comment 3")), AND(B2="category 2",OR(C2="comment 4",C2="comment 5")), AND(B2="category 3",OR(C2="comment 6",C2="comment 7")))
hopefully you can substitute the proper text in each case you want.
May 28 2020 11:03 PM
May 29 2020 12:56 AM
Please attach your sample file with data and desired results therein.
May 29 2020 01:15 AM
You can use LOOKUP function and make this dynamic array.
LOOKUP(field to search, first column where search is being done, what to return when search is matched).
Try this and confirm if this is feasible solution.
May 29 2020 03:58 AM
Please find the attached sample file and help him to get the desired result.
Column A- Category
Column B- Notes
Column C- Manually I checked whether Category matching with the notes or not
Column D- Please add the formula to check whether the correct notes selected for correct category
Note: CM- Account Credit (contl) and CM - Account Transfer (contl)----Number-Notes( No Spaces)
For Category CM - Account Closed (contl)- notes should be without number ie Closed or Dormant
May 29 2020 04:34 AM
Could you please clarify the logic a bit more. For example, in left table
CM- Account Credit (contl) | 1- credit | Error |
having 1-credit for this category in right table, but
CM- Account Credit (contl) | 3-credit | No Error |
has no error. If we ignore numbers, both shall return No Error. If not, it shall be an opposite.
May 29 2020 05:27 AM
@Sergei Baklan - There is space after hyphen, so it is error.
CM- Account Credit (contl) | 1- credit | Error |
May 29 2020 05:39 AM - edited May 29 2020 05:42 AM
@resham1985 So if I understand correctly the note should have a number followed by "-Credit" or "-rejected" etc...
I would recommend that you split those into 2 separate columns to make your life easier and the sheet more functional. If you need a column with that specific format you can "build" it. For example you have 1 col that is # and another column that is action (e.g. credit vs rejected etc...). You can have specific controls on each of those columns. The a 3rd col that would TEXTJOIN those 2 columns with an "-" or in the last case just where there are no numbers just use the later col.
That said, if you still want to limit the entry to only that format you can make the validation formula more complicated. Here is an example where I changed the Data Validation formula above using the search function to make sure at least the non-numbered part is correct:
=OR(AND(B2="category 1",OR(search("comment 1",C2),search("comment 2",C2),search("comment 3",C2))), AND(B2="category 2",OR(search("comment 4",C2),search("comment 5",C2))), AND(B2="category 3",OR(search("comment 6",C2),search("comment 7",C2))))
May 29 2020 05:53 AM
SolutionI'd also recommend to re-design right table a bit as
with Helper column calculated as
=TRIM(IFERROR(
RIGHT(
$H$3:INDEX($H$3:$H$100,COUNTA($H$3:$H$100)),
LEN($H$3:INDEX($H$3:$H$100,COUNTA($H$3:$H$100))) -
FIND("-",$H$3:INDEX($H$3:$H$100,COUNTA($H$3:$H$100)))),
$H$3:INDEX($H$3:$H$100,COUNTA($H$3:$H$100))))
Status could be calculated as
by formula
=IF(COUNTIFS(
$G$3:INDEX($G$3:$G$100,COUNTA($G$3:$G$100)),
$A2,
$I$3:$I$9,
IFERROR(RIGHT($B2,LEN($B2)-FIND("-",$B2)),$B2)
),"No Error", "Error")
May 29 2020 06:24 AM
Please find the attached file for your reference.
Category | Notes |
CM- Account Credit (contl) | 1-Credit |
1-hold | |
1-Debit | |
CM - Account Transfer (contl) | 2-transfer or 2- rejected |
CM - Account Closed (util) | Closed, Dormant |
For CM- Account Credit (contl) and CM - Account Transfer (contl)- notes should be number-Notes without spaces.
CM - Account Closed (util)- Notes should be without number(Closed or Dormant)
May 29 2020 06:41 AM
@resham1985 in the attached I have 5 'helper' columns of which 3 are hidden. I have a # col and a comment type column and then a "Notes" column that compiles the # with the type. The 3 hidden columns create a list of potential allowed comment types based on the category. I added conditional formatting on the "Notes" column to check if something is missing and data validation on the # col and the type cols.
This can all get merged into a single col but it just gets more complicated.
May 29 2020 05:53 AM
SolutionI'd also recommend to re-design right table a bit as
with Helper column calculated as
=TRIM(IFERROR(
RIGHT(
$H$3:INDEX($H$3:$H$100,COUNTA($H$3:$H$100)),
LEN($H$3:INDEX($H$3:$H$100,COUNTA($H$3:$H$100))) -
FIND("-",$H$3:INDEX($H$3:$H$100,COUNTA($H$3:$H$100)))),
$H$3:INDEX($H$3:$H$100,COUNTA($H$3:$H$100))))
Status could be calculated as
by formula
=IF(COUNTIFS(
$G$3:INDEX($G$3:$G$100,COUNTA($G$3:$G$100)),
$A2,
$I$3:$I$9,
IFERROR(RIGHT($B2,LEN($B2)-FIND("-",$B2)),$B2)
),"No Error", "Error")