Help

Re: Can I tell an IF statement to ignore certain existing data?

475 0
cancel
Showing results for 
Search instead for 
Did you mean: 
Kiana_Brown
4 - Data Explorer
4 - Data Explorer

(I’m using a very pared-down example here in hopes that I can convey what I’m trying to do, and then apply a solution to my actual base where I’m having this issue.)

image

I paste data into my base from an internal report weekly. When I paste records from that report, some of the records already have numerical data in Column 2, and those records will be blank in Column 1.

If a pasted record does NOT have numerical data in Column 2, that means it will have existing numerical data in Column 1 (and it’s data that is essentially related to Column 2).

It is more important to me that every record has data in Column 2.

For records with data in Column 1, I can calculate what belongs in Column 2 by using a simple formula - for the sake of example, let’s say the formula is {Column 1} * 2 . However, if there is existing data in Column 2 (i.e. Column 1 is blank), I need the existing data in Column 2 to stay put.

I want to write an IF statement for Column 2 that essentially says:

“IF Column 1 has a number in it, THEN return a value by applying this formula. IF NOT, then leave alone any data that already exists in Column 2.”

i.e. IF({Column 1}>0, {Column 1} * 2), LEAVE IT ALONE)

The LEAVE IT ALONE part is where I’m stuck. Is there a way to tell Airtable to ignore any existing data if the IF statement doesn’t apply to it?

Hopefully that all makes sense! :upside_down_face:

1 Reply 1

Welcome to the community, @Kiana_Brown! :grinning_face_with_big_eyes: You can’t add a formula to a field where you’re also manually entering data. Airtable formulas exist in their own fields, and cannot affect the contents of other fields.

The best that you can do here is add a new formula field that does the required math for situations where {Column 2} is empty, and echoes the existing {Column 2} value otherwise:

IF({Column 1} > 0, {Column 1} * 2, {Column 2})

Screen Shot 2021-08-23 at 8.56.35 PM

The formula field effectively replaces {Column 2} when it comes to using those values elsewhere for further calculations.