If + Autonumber

Topic Labels: Formulas
2646 4
Showing results for 
Search instead for 
Did you mean: 
5 - Automation Enthusiast
5 - Automation Enthusiast

Sorry if this has been asked before. Is it possible to add logic such as. IF column X is “yes” then populate a autonumber column, ELSE leave blank? Thanks.

4 Replies 4
8 - Airtable Astronomer
8 - Airtable Astronomer

An auto number field is pre-populated.
What you will want to do is to create a new column eg “auto 2” to achieve the functionality you are wanting

The column “auto 2” will be of type formula.

The formula will be

IF(X=“yes”, AutonumberColumn, “”)

Where AutonumberColumn is your column of type “auto number”
You will also want to probably hide the column “AutonumberColumn” in your view

Cheers, thanks for that.
That method does mean though that the Autonumber column will increment up even for records that don’t satisfy the IF statement though - any way to avoid this?
The scenario I am thinking about is for assigning bib numbers at a sporting event from one member database (as in not all members will be attending the event). Its useful for me to not have the autonumber increment up for members not attending since then I don’t have to print so many bibs.

I’ve played around adding the autonumber column in a filtered view but autonumber still populates all records in the table.

Thanks for your help and suggestions.

The easiest way to accomplish what you want is, when you are ready to print bibs,

  1. Go to a grid view filtered to show only members attending.
  2. Sort the view in such a way as to put attending records in advance of non-attending — for instance, if you use a check box to indicate members in the race, sort records in | :ballot_box_with_check: ️ → :white_large_square: | order.
  3. Right-click on your autonumber field and change the field type to either number or single-line text. Click 'Save'.
  4. Right-click on the [formerly] autonumber field and change the field type back to autonumber. Click 'Save'.

This will causes the autonumber field to be regenerated. Since the table has been sorted to list attending members first, they receive numbers beginning with 1,2,3..'. Do whatever you do to print the bib numbers (export them, print using the Page Designer Block, etc.).

If you are using the autonumber field for something where you need some sort of persistence, create a second autonumber field called {Bib} that you can rewrite for each event.

5 - Automation Enthusiast
5 - Automation Enthusiast

Cheers, I’ll do that - thanks for your help.