Hey @LizRVSF,
For this uses cases you can always try leveragin ChatGPT :D.
I did not give it a shot yet manually on my side (I promise I’ll try to get back to this). However, you might want to try this formula out in the meantime:
IF(
{Contracts},
{Final Initials (from Farmers)} & "-" &
{Program (from Contracts)} & "-" &
{Seed Variety (from Contracts)} & "-" &
RIGHT({Crop Year (from Contracts)}, 2) & "-" &
{Contracts} & "-" &
SUBSTITUTE(
IF(
OR(
{To Bin} = "HK 01",
{To Bin} = "HK 02",
{To Bin} = "HK 03",
{To Bin} = "HK 48",
{To Bin} = "HK 49"
),
{To Bin},
IF(
OR(
{To Bin} = "HPB1",
{To Bin} = "HPB2",
{To Bin} = "GP WHPB",
FIND("Cleaner", {To Location})
),
{From Bin},
{To Bin}
)
),
"Bin ",
""
),
{Final Initials (from Farmers)} & "-" &
{Program} & "-" &
{Seed Variety} & "-" &
RIGHT({Crop Year}, 2) & "-" &
SUBSTITUTE(
IF(
OR(
{To Bin} = "HK 01",
{To Bin} = "HK 02",
{To Bin} = "HK 03",
{To Bin} = "HK 48",
{To Bin} = "HK 49"
),
{To Bin},
IF(
OR(
{To Bin} = "HPB1",
{To Bin} = "HPB2",
{To Bin} = "GP WHPB",
FIND("Cleaner", {To Location})
),
{From Bin},
{To Bin}
)
),
"Bin ",
""
)
)
I took a quick look at it and it seems to make sense!
Completely different matter, but would love to have you join our Airtable Hackathon! Make sure to sign up!!
Mike, Consultant @ Automatic Nation
YouTube Channel
Thank you so much Mike. I’ve been using ChatGPT and still not working 🤣
Mike you are a rock star! 😎 got an error with your formula, then I ask ChatGPT to improve it. It fixed it and now it’s working. What changed:
RIGHT("" & {Crop Year...}, 2) is used to avoid an error when the year is stored as a number.
I replaced FIND("Cleaner", {To Location}) with REGEX_MATCH(LOWER({To Location} & ""), "cleaner") — this prevents an error if {To Location} is empty and also makes the match case-insensitive.
I kept SUBSTITUTE(..., "Bin ", "") to remove the "Bin " prefix when it exists.
Here is the final version:
IF(
{Contracts},
{Final Initials (from Farmers)} & "-" &
{Program (from Contracts)} & "-" &
{Seed Variety (from Contracts)} & "-" &
RIGHT("" & {Crop Year (from Contracts)}, 2) & "-" &
{Contracts} & "-" &
SUBSTITUTE(
IF(
OR(
{To Bin} = "HK 01",
{To Bin} = "HK 02",
{To Bin} = "HK 03",
{To Bin} = "HK 48",
{To Bin} = "HK 49"
),
{To Bin},
IF(
OR(
{To Bin} = "HPB1",
{To Bin} = "HPB2",
{To Bin} = "GP WHPB",
REGEX_MATCH(LOWER({To Location} & ""), "cleaner")
),
{From Bin},
{To Bin}
)
),
"Bin ",
""
),
{Final Initials (from Farmers)} & "-" &
{Program} & "-" &
{Seed Variety} & "-" &
RIGHT("" & {Crop Year}, 2) & "-" &
SUBSTITUTE(
IF(
OR(
{To Bin} = "HK 01",
{To Bin} = "HK 02",
{To Bin} = "HK 03",
{To Bin} = "HK 48",
{To Bin} = "HK 49"
),
{To Bin},
IF(
OR(
{To Bin} = "HPB1",
{To Bin} = "HPB2",
{To Bin} = "GP WHPB",
REGEX_MATCH(LOWER({To Location} & ""), "cleaner")
),
{From Bin},
{To Bin}
)
),
"Bin ",
""
)
)