Help

making a date from a formula output appear in bold.

Topic Labels: Formulas
1591 1
cancel
Showing results for 
Search instead for 
Did you mean: 
nasw95
4 - Data Explorer
4 - Data Explorer

I know using a formula like this-

IF(
{T-Shirt Size} = "extra small",
DATETIME_FORMAT(WORKDAY({Expected Final Files}, -2), 'MM/DD/YYYY'),
IF(
{T-Shirt Size} = "small",
DATETIME_FORMAT(WORKDAY({Expected Final Files}, -6), 'MM/DD/YYYY'),
IF(
{T-Shirt Size} = "medium",
DATETIME_FORMAT(WORKDAY({Expected Final Files}, -13), 'MM/DD/YYYY'),
IF(
{T-Shirt Size} = "large",
DATETIME_FORMAT(WORKDAY({Expected Final Files}, -22), 'MM/DD/YYYY'),
IF(
{T-Shirt Size} = "extra large",
DATETIME_FORMAT(WORKDAY({Expected Final Files}, -30), 'MM/DD/YYYY'),
""
)
)
)
)
)
 
Gives me the date in the format I want but I would like to have it in bold and Airtable says "Your result type is not a number or a date. Formatting options are currently only available if your result type is a number or a date." I know this is a result of using DATETIME_FORMAT. I updated the formula to:

IF(
{T-Shirt Size} = "extra small",
DATEADD({Expected Final Files}, -2, 'days'),
IF(
{T-Shirt Size} = "small",
DATEADD({Expected Final Files}, -6, 'days'),
IF(
{T-Shirt Size} = "medium",
DATEADD({Expected Final Files}, -13, 'days'),
IF(
{T-Shirt Size} = "large",
DATEADD({Expected Final Files}, -22, 'days'),
IF(
{T-Shirt Size} = "extra large",
DATEADD({Expected Final Files}, -30, 'days'),
""
)
)
)
)
)

And still get the same error message from Airtable. If anyone could please advise, I would truly appreciate it. Thanks!

1 Reply 1
Andy_Lin1
9 - Sun
9 - Sun

You can't change the text formatting in a field unless it's a Long text field with rich formatting turned on, unfortunately. The formatting options in a formula field are the same as those in a date time field (or number/currency/percent field, depending on what your formula outputs).

That being said, if you'd like to know how to get rid of the error message you're seeing, for the first formula, just remove all the DATETIME_FORMAT functions. DATETIME_FORMAT outputs a string representation of a date, which Airtable then sees only as a text string and not a date; for the second formula, you'll need to delete the else portion of the innermost IF function (the ,"" for the extra large size), since it lets the formula output a string (in every other outcome of the formula, you'd get a date object).

Side note: you can change the nested IF functions into a single SWITCH function, which can help with legibility and maintenance. For example, the first formula would look like:

IF( {T-Shirt Size},
  DATETIME_FORMAT(
    WORKDAY{Expected Final Files},
      SWITCH( {T-Shirt Size},
        "extra small", -2,
        "small", -6,
        "medium", -13,
        "large", -22,
        "extra large", -30
      )
   ),
  'MM/DD/YYYY')
)

(The IF function is to catch cases where {T-Shirt Size} is empty. You can also add an extra argument to the SWITCH function to catch cases where {T-Shirt Size} isn't one of the listed options.)

As an alternative to bold text, if you want to call attention to the field, you can use colours if your plan allows for it, or maybe emoji. There is also the highly janky, early 2000s method of replacing the numbers with those from the bold math section of Unicode, using SUBSTITUTE for each individual digit (there's no heavy slash in Unicode that I'm aware of); you can quickly preview such digits using a site like https://yaytext.com/bold-italic/ . Note that I haven't tried to nest that many SUBSTITUTE functions, but it should work in theory. Note also that the resulting numbers may not display properly nor will they be automatically converted to regular numbers when copied and pasted.