Companion to Section 8 of the main user manual | Beta Version 1.0 | April 2026
A rule is one row on the DCP_Rules tab. It tells the tool “whenever you see a row that looks like this, do that.”
Think of it the same way you'd write an instruction for a colleague reviewing the same report by hand:
That sentence is a rule. On the DCP_Rules sheet, that same instruction is split across 12 columns — one column per element of the sentence. The macro reads every rule on every row, decides which rows match, and applies the labels and colours to your output file.
You can have as many rules as you like. Rules never conflict dangerously — the worst
that can happen is two rules label the same row, in which case both labels appear in the
Rule Hits column and the row takes the colour of whichever rule fires first in
sheet order.
A token is a short internal name for a column in the source file. Rules talk to columns through tokens.
The Oracle DCP report has dozens of columns, and the exact header text sometimes changes (Inventory Org one month, Inv Org the next). The tool solves this with a two-layer lookup:
Inventory Org, Potential Shortage /Excess,
Buyer Default Name.Because of this, rules only need to know the token. If Oracle renames a header next year, you edit DCP_Columns once and every rule that references that token keeps working.
A is the complete list of tokens available to you. Any token you see there
can be used in the Scope Token or Trigger Token cell of a rule.
Every rule has three logical parts: Scope (who does this apply to?), Trigger (what condition fires it?), and Action (what do we do when it fires?). The 12 columns on the sheet break down into these three parts.
The shorthand:
| Part | Columns | What it answers |
|---|---|---|
| SCOPE | D, E | Which subset of rows this rule applies to. Optional — skip it to apply the rule to every row. |
| TRIGGER | F, G, H | The actual test: pick a column, pick an operator, pick a value. |
| ACTION | I, J, L | What to do when the test passes: keep/drop the row, tag it, colour it. |
| Organisation | A, B, C, K | On/off switch, ID, human name, free-text notes. No effect on the logic. |
Each column on DCP_Rules in the order they appear on the sheet.
Accepts Y or N.
Y — the rule is active. The tool will evaluate it on every row of
the source file during the next Run Extract.N — the rule is parked. The tool reads the row but does nothing with
it. All its other settings are preserved for when you turn it back on.
A short label like R1, R2, R3. Purely for human
reference — the tool doesn't use it internally.
R1
through R5; your own rules can pick up from R6.
A one-line, human-readable description of what the rule does. For example: Flag all rows where potential shortage is below zero.
The name of the column (a token, see Section 2) whose value decides whether this rule applies to a given row. Leave blank to apply the rule to every row.
Inventory Org and put the three org numbers
into the next column (Scope Values). The rule will evaluate its trigger only on rows in those
orgs and ignore every other row.
Inventory Org, Buyer Default Name).
The tool treats the entire cell as one column name, fails the lookup, and the rule silently
never fires. To combine two column conditions, see Section 7's
“Scope + Trigger = AND” example — that pattern lets you test two
different columns in a single rule.
A comma-separated list of values to match against the Scope Token column. If the row's value in that column is in the list, the rule proceeds to its trigger. If not, the rule does nothing on that row.
| Scope Token | Scope Values | Meaning |
|---|---|---|
| (blank) | (blank) | Apply to every row. |
Inventory Org | 320, 327, 613 |
Apply only to rows in orgs 320, 327, or 613. |
Buyer Default Name | Alice, Bob |
Apply only to rows whose buyer is Alice or Bob. |
Item Source Type | Supplier |
Apply only to supplier-sourced items. |
Buyer names in Oracle are often formatted Smith, John — the value itself
contains a comma. A plain comma-separated list would split that one name into two. To handle
this, the Scope Values cell supports a semicolon auto-detect:
| What you type in column E | How the tool parses it |
|---|---|
320, 327, 613 |
Comma list — splits into 320, 327, 613. |
Smith, John; Doe, Jane |
Contains a semicolon → splits on ; into
Smith, John and Doe, Jane. |
Smith, John |
No semicolon → the tool splits on comma and looks for two values
(Smith and John). Will not match the buyer. Add a trailing
semicolon: Smith, John; to force semicolon mode. |
The name of the column that the rule actually inspects — the column whose value decides whether the rule fires. This is required for every rule.
The comparison to perform between the Trigger Token's cell value and the Trigger Value. You pick one from the following list:
| Operator | Meaning | Example (cell = 5, rule Trigger Value = 10) |
|---|---|---|
LT | Less than | 5 < 10 → fires |
LE | Less than or equal | 5 ≤ 10 → fires |
GT | Greater than | 5 > 10 → does not fire |
GE | Greater than or equal | 5 ≥ 10 → does not fire |
EQ | Equals (case-insensitive for text) | 5 = 10 → does not fire |
NE | Not equal | 5 ≠ 10 → fires |
IN |
Cell value is in the comma-list you provided | Cell = Active, Trigger Value = Active, Pending → fires |
NOTIN |
Cell value is not in the comma-list | Cell = Active, Trigger Value = Obsolete → fires |
BLANK |
Cell is empty or holds a blank sentinel (see note below). Trigger Value is ignored. | Empty cell → fires. Cell = - → fires. |
NOTBLANK |
Cell has a real value (not empty, not a blank sentinel). Trigger Value is ignored. | Cell = Supplier → fires. Cell = - → does not fire. |
CONTAINS |
Cell contains the Trigger Value as a substring (case-insensitive) | Cell = Manual Plan, Trigger Value = plan → fires |
LT/GT for numbers,
EQ/NE for single-value text, IN/NOTIN
for a list of text values, and BLANK/NOTBLANK when the presence or
absence of a value is what matters.
- counts as blank
Oracle and several other source systems export a literal dash (-) when a field
has no value, instead of leaving the cell empty. To keep BLANK and
NOTBLANK rules working on that data, the tool treats a configurable list of
sentinel values as blank.
The list lives on the Run tab in cell
C12 (Blank indicators). The default is:
| Cell on Run tab | Default value | Meaning |
|---|---|---|
C12 |
-, --, N/A, #N/A, NA |
Any cell whose trimmed value matches one of these (case-insensitive) is
considered blank by BLANK / NOTBLANK. Truly empty cells
are always blank regardless of this list. |
C12, and re-run the
extract. No VBE access required. Clearing the cell resets it to the default on the next
Setup Workbook or Amend Sheet Setup.
BLANK / NOTBLANK
consult this list. EQ, IN, CONTAINS etc. still match
literally — if you want a rule to fire on cells equal to -, write
EQ with Trigger Value -. Numeric operators
(LT/GT) treat non-numeric dashes as zero, which is a separate
quirk: filter those rows out on DCP_Filters if it matters.
The value you compare against. This is entirely user-determined — the tool does not suggest, derive, or auto-fill this cell. You type whatever value makes sense for the operator you picked.
| Operator | What to type in Trigger Value |
|---|---|
LT, LE, GT, GE |
A single number: 0, 100, -5. |
EQ, NE |
A single text or number: Active, Supplier, 0. |
IN, NOTIN |
A comma-separated list: 320, 327, 613 or Active, Pending.
If any of your values already contains a comma (e.g. buyer names like
Smith, John), switch the whole list to semicolons instead
— the parser auto-detects the delimiter. See the note below. |
BLANK, NOTBLANK |
Leave blank. The value is ignored. |
CONTAINS |
A substring: plan, drop, 2026. |
EQ with value
0 matches numeric zero only; it will not match the text “Zero”.
IN / NOTIN list contains values with commas
Same rule as Scope Values in §4.5: if any value you want to list already contains a
comma, switch the whole list to semicolons. As soon as the parser sees a ; in
the cell it treats semicolons as the separator and leaves embedded commas intact.
| What you type in Trigger Value | How the rule engine reads it |
|---|---|
IN = 320, 327, 613 |
Three values: 320, 327, 613. Works as expected. |
IN = Smith, John; Doe, Jane |
Two values: Smith, John and Doe, Jane. Semicolon wins. |
IN = Smith, John |
Two broken fragments: Smith and John. Add a trailing
semicolon — Smith, John; — to force semicolon mode for a
single buyer name. |
What the tool does when the rule fires on a row. Pick one of:
| Action | Effect |
|---|---|
| FLAG | Keep the row in the output. Add the rule's Tag Text to the
Rule Hits column and paint the row in the rule's Highlight colour.
Most rules you write will be FLAG rules. |
| DROP | Remove the row from the output entirely. Use this when you want to hide rows you've already decided are noise. DROP takes precedence over every other action — if any DROP rule fires, the row disappears. |
| KEEP_ONLY | Mark the row as a “keeper”. If any KEEP_ONLY rule is enabled anywhere on the sheet, the tool flips its behaviour: only rows that fire at least one KEEP_ONLY rule are written to the output. All other rows are dropped. |
A short label — usually 1 to 10 characters — that gets added to the
Rule Hits column on the output file whenever this rule fires. If multiple rules
fire on the same row, their tags are joined with a semicolon: SHORTAGE; R4 HIT.
Rule Hits column is how you spot which
rule caught a row. Keep tag texts short and unique so you can filter or sort the output
file on them easily.
| Good Tag Text | Why |
|---|---|
SHORTAGE | Short, ALLCAPS, describes the condition. |
EXCESS | Short, ALLCAPS, descriptive. |
R4 HIT | Ties back to Rule ID for quick reference. |
No supplier | Readable, specific. |
Free-text notes. The tool doesn't read this column at all. Use it to record why you created the rule, who asked for it, or when it was last reviewed.
The colour the tool paints the row when this rule fires. There are six ways to specify a colour — pick whichever feels most natural.
| Format | What to type in column L | Example |
|---|---|---|
| Keyword | SHORTAGE (preset light red) or EXCESS (preset light lavender). |
SHORTAGE EXCESS |
| Colour name | One of ~24 built-in names: RED, BLUE, GREEN,
YELLOW, ORANGE, PURPLE, PINK,
HOTPINK, LIGHTBLUE, LIGHTGREEN, LIGHTYELLOW,
LAVENDER, CYAN, MAGENTA, GRAY,
LIGHTGRAY, AMBER, SALMON, GOLD,
etc. |
HOTPINK |
| Hex code | #RRGGBB web hex. |
#FF69B4 |
| R,G,B | Three numbers 0-255 separated by commas. | 255,105,180 |
| Long value | A single Excel colour integer (advanced; copy from another workbook's Immediate window). | 11862015 |
| Cell fill | Leave column L blank and paint the cell itself with Excel's paint-bucket. The tool reads the cell's fill colour. | Yellow-painted cell → yellow row |
For each row in the source file, the tool walks every enabled rule through the decision tree below. This explains exactly what happens and in what order.
DROP rule fires, the row is removed and no further rules are
evaluated for that row.Rule Hits column.KEEP_ONLY rule is enabled
anywhere, rows that didn't fire at least one KEEP_ONLY rule are dropped.Follow these six steps to create any rule, from the simplest flag to a scoped KEEP_ONLY combination.
Rule Hits, and confirm the right rows have your Tag Text.
Enabled = N lets you type the
whole row, save, and come back to it later — the tool won't evaluate it until you
flip it to Y.
Each example starts with the plain-English sentence, then shows exactly what goes in each column.
“Flag a row only when Inventory Org = 898 AND Item Source Type = Make.”
Every rule has two column slots: Scope (columns D+E) and Trigger (columns F+G+H). A rule only fires when both slots match on the same row, so you already have AND built in. Put one condition in Scope and the other in Trigger:
| A Enabled | B Rule ID | C Rule Name |
D Scope Token | E Scope Values |
F Trigger Token | G Op | H Trig Value |
I Action | J Tag Text | K Notes | L Highlight |
|---|---|---|---|---|---|---|---|---|---|---|---|
| Y | R20 | Flag org 898 Make items | Inventory Org | 898 |
Item Source Type | EQ | Make | FLAG | 898 MAKE | Two-column AND | ORANGE |
“Any row whose Potential Shortage /Excess is less than zero → highlight red and tag SHORTAGE.”
| A Enabled | B Rule ID | C Rule Name |
D Scope Token | E Scope Values |
F Trigger Token | G Op | H Trig Value |
I Action | J Tag Text | K Notes | L Highlight |
|---|---|---|---|---|---|---|---|---|---|---|---|
| Y | R1 | Flag shortages | (blank) | (blank) | Potential Shortage /Excess | LT | 0 | FLAG | SHORTAGE | Factory rule | SHORTAGE |
“For rows in orgs 320, 327, or 613, if Potential Shortage /Excess is less than zero → tag 'MY ORG SHORT' in pink.”
| A | B | C | D | E | F | G | H | I | J | K | L |
|---|---|---|---|---|---|---|---|---|---|---|---|
| Y | R6 | My team shortages | Inventory Org | 320, 327, 613 |
Potential Shortage /Excess | LT | 0 | FLAG | MY ORG SHORT | Added 2026-04 | HOTPINK |
“Any row whose Buyer Default Name equals ToBeReassigned → remove from output.”
| A | B | C | D | E | F | G | H | I | J | K | L |
|---|---|---|---|---|---|---|---|---|---|---|---|
| Y | R7 | Drop reassigned-buyer noise | (blank) | (blank) | Buyer Default Name | EQ | ToBeReassigned | DROP | (ignored) | Per Jane, 2026-04 | (ignored) |
“Show me rows where Potential Shortage /Excess is below 0 (R5) OR above 0 (R6). Hide every other row.”
Two rules together, both with Action = KEEP_ONLY:
| A | B | C | D | E | F | G | H | I | J | K | L |
|---|---|---|---|---|---|---|---|---|---|---|---|
| Y | R5 | Keep shortages | (blank) | (blank) | Potential Shortage /Excess | LT | 0 | KEEP_ONLY | SHORT | SHORTAGE | |
| Y | R6 | Keep excesses | (blank) | (blank) | Potential Shortage /Excess | GT | 0 | KEEP_ONLY | EXCESS | EXCESS |
KEEP_ONLY rule is enabled, rows that fire
no KEEP_ONLY rule are dropped. In Example D, rows with zero potential
shortage/excess disappear entirely. That's intentional.
“For rows whose Item Source Type is Supplier, if Item Inventory Org (Source) is blank, flag as 'MISSING SRC ORG' in amber.”
| A | B | C | D | E | F | G | H | I | J | K | L |
|---|---|---|---|---|---|---|---|---|---|---|---|
| Y | R8 | Supplier missing source org | Item Source Type | Supplier |
Item Inventory Org (Source) | BLANK | (blank) | FLAG | MISSING SRC ORG | Data-quality check | AMBER |
Every way you can tell the tool what colour to paint a flagged row.
| Name you can type | Approximate shade |
|---|---|
RED | Pure red |
GREEN | Pure green |
BLUE | Pure blue |
YELLOW | Pure yellow |
ORANGE | Orange |
PURPLE | Purple |
PINK | Soft pink |
HOTPINK / BOLDPINK | Bold pink |
LIGHTPINK | Lighter pink |
LIGHTBLUE | Light blue |
LIGHTGREEN | Light green |
LIGHTYELLOW | Very light yellow |
LAVENDER | Pale lavender |
CYAN | Cyan |
MAGENTA | Magenta |
GRAY / GREY | Mid gray |
LIGHTGRAY / LIGHTGREY | Light gray |
AMBER | Amber (the fallback) |
SALMON | Salmon |
GOLD | Gold |
WHITE / BLACK | White / Black (use with care) |
SHORTAGE or EXCESS)#RRGGBB)255,105,180)That's it. The rule's flagged rows will match the colour you painted.
| Symptom | Likely cause | Fix |
|---|---|---|
| Rule never fires, even though I can see matching rows in the source. | The Scope Token or Trigger Token doesn't match a token on DCP_Columns. Typo, or the token was removed. | Check spelling against DCP_Columns column A. Tokens are case-insensitive but must be otherwise identical (spaces count). |
| Rule fires on every row, not just the ones I wanted. | Scope Token is blank. An empty Scope means “apply to every row”. | Fill in a Scope Token and Scope Values, or use a narrower Trigger condition. |
| I put two token names in Scope Token separated by a comma and the rule never fires. | Scope Token is a single column — not a list. The engine treats
Inventory Org, Item Source Type as a literal column name and can never
find a match. |
Use the Scope + Trigger AND pattern (Section 7, Example AA): put one condition in Scope (D+E), the other in Trigger (F+G+H). For three or more conditions, chain two rules with the same Tag Text, or move one condition to DCP_Filters. |
A rule on buyer names like Smith, John never fires, even though I
copied the name exactly. |
Your Scope Values / Trigger Value list uses commas, but the buyer name itself
contains a comma. The parser splits on the comma inside the name and ends up looking
for Smith and John as two separate buyers. |
Switch the list to semicolons: Smith, John; Doe, Jane. For a
single buyer name, add a trailing semicolon to force semicolon mode:
Smith, John;. See Section 4.5 and Section 4.8 for the full parse table. |
My BLANK rule doesn't fire, even though the cell looks empty. |
The source cell contains a sentinel like -, --, or
N/A — not a truly empty cell. The default sentinel list covers the
common ones, but the source may be using something else (e.g. None,
TBD). |
Open the Run tab, edit cell C12
(Blank indicators), and add the token. Separate tokens with commas:
-, --, N/A, #N/A, NA, None, TBD. Re-run the extract. |
A LT / GT rule doesn't fire on what looks like a number. |
The source cell contains the value as text, not as a number. Oracle sometimes exports numbers as text. | Check the cell in the source file. If it's left-aligned, it's text. Re-save the
source, or use CONTAINS with the text you need. |
| Flagged row is amber, not the colour I specified. | Typo in column L, or a colour name the tool doesn't recognise. | Pick a name from the cheat sheet in Section 8. When in doubt, just paint the cell. |
| KEEP_ONLY rule dropped rows I wanted to see. | As soon as one KEEP_ONLY rule is enabled, every row that doesn't
fire a KEEP_ONLY rule is dropped. |
Either add more KEEP_ONLY rules covering the rows you want to keep,
or switch the action back to FLAG. |
| Multiple rules fire but only one tag shows up. | One of the firing rules has Action = DROP. DROP removes the row, so
no other tags are written. |
Change the DROP rule to FLAG, or exclude that row from the DROP rule's scope. |
| I deleted a rule row and now something's off. | Rules are read top-to-bottom, and highlight colour comes from the first firing rule. | Order matters only for colour. If colour changes, re-check which rule now fires first on that row. |
| Setup Workbook wiped my custom rules. | Setup Workbook is a hard reset that re-seeds every sheet. | Use Amend Sheet Setup after first-time setup. It preserves existing rows. |
| Term | Meaning |
|---|---|
| Token | Internal name for a column (like Inventory Org). Listed in column A
of DCP_Columns. Rules reference columns via tokens,
not via the raw source header text. |
| Alias | One of the possible source header texts that the tool should accept as matching a given token. Aliases live in column B of DCP_Columns. |
| Rule | A single row on DCP_Rules that tests every row of the source and performs an action (FLAG / DROP / KEEP_ONLY) on matches. |
| Scope | The optional narrowing clause of a rule — “only apply to rows where X matches one of these values”. Columns D and E together. |
| Trigger | The condition that fires the rule — column, operator, value. Columns F, G, and H together. |
| Action | What happens when the rule fires. One of FLAG, DROP,
KEEP_ONLY. Column I. |
| Tag Text | Short label appended to the output's Rule Hits column when the rule
fires. Column J. |
| Highlight | Colour spec (keyword, name, hex, R,G,B, long, or cell fill) used to paint the row when the rule fires. Column L. |
| Rule Hits column | The last column in the output .xlsx, auto-added by the tool. Contains the joined Tag Text values of every rule that fired on that row. |
| FLAG | Action that keeps the row, tags it, and paints it. |
| DROP | Action that removes the row from the output entirely. Beats FLAG. |
| KEEP_ONLY | Action that flips the tool into “only show rows that fire at least one KEEP_ONLY rule” mode — a whitelist. All non-whitelisted rows are dropped. |
| Operator | The comparison performed between the Trigger Token cell and the Trigger Value.
One of LT, LE, GT, GE, EQ,
NE, IN, NOTIN, BLANK,
NOTBLANK, CONTAINS. |
| Trigger Value | The reference value you compare against. User-typed. For IN /
NOTIN, a comma-separated list; for BLANK / NOTBLANK,
ignored. |
| Enabled | Column A switch. Y runs the rule; N parks it for later. |
DCP_User_Manual.html. For all other sheets, refer to the main manual.
ytcodes.dev