-1

I have three columns A B C.

I want to put the data in column C that exists in either column A or B. Only one column in A or B will have data.

Examples:

Data in Column A: 123456789

Data in Column B:

Data That Goes in Column C: 123456789

Data in Column A:

Data in Column B: 987654321

Data That Goes in Column C: 987654321

Thank you for that last answer.

I need slight variation on that:

I want to put text in column C based on data that exists in either column A or B. Only one column in A or B will have data. If data is in column A - then text in column C will always be "UPC". If data is in column B - then text in column C will always be "EAN". Column C will carry this formula, columns A & B have formulas that pull data from another tab.

Examples:

Data in Column A: 123456789

Data in Column B:

Data That Goes in Column C: UPC

Data in Column A:

Data in Column B: 987654321

Data That Goes in Column C: "EAN"

  • 1
    Using the basic simple formula =A2 & B2 gives the desired results since only one column or the other will contain data. But I was thinking of a more intelligent way in terms of validating if A contains data use that, if B contains data use that. – nokodev Mar 8 '18 at 17:07
  • Looks like I will need another variation on this issue: I have three columns A B C. I want to put certain data in column C based on which column A or B has data contained in it. Only one column in A or B will have data. Examples: Data in Column A: 123456789 Data in Column B: Data That Goes in Column C: UPC Data in Column A: Data in Column B: 987654321 Data That Goes in Column C: EAN – nokodev Mar 8 '18 at 17:15
  • Please dont provide new information in comments, but edit your question. How should Excel (we) know when to use EAN / UPC??? – Máté Juhász Mar 9 '18 at 5:25
2

Seem like a simple IF() statement with ISBLANK() is what you need.

Check if your A value is blank, if not, then use it's value. If so, then check if your B value is blank, if not, then use it's value.

If both criteria comes out to be blank, just use an empty string (this lets you prepopulate a large range and have it appear blank until the data goes in).

=IF(ISBLANK(A1)=FALSE, A1,IF(ISBLANK(B1)=FALSE, B1,""))

enter image description here

One caveat: This assumes the blank cells are actually empty. If the empty cells aren't actually empty (e.g., you're using a formula to display either a value or a blank cell in columns A and B), ISBLANK won't work.


If you are not pre-populating the C column with your formula, then an easier approach is to simply use

=IF(ISBLANK(A1), B1, A1)

If you were to pre-populate with this formula, then in conditions where both the A & B columns are blank the formula would return 0.

| improve this answer | |
  • That formula seemed to work fine (even though A & B do have formulas in the carrying over data from another tab). =IF(ISBLANK(A1), B1, A1) – nokodev Mar 9 '18 at 13:20

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.