Calnor
Calnor

Reputation: 23

If Then, concatenate when condition is met

I want to simplify an everyday work task. I am looking for a macro or a formula that will look at Column C, and if New is present, combine N with the data from Column A; if Used is present, combine U with the data from Column A.

Before:

      A         B         c
   123456                New
   234657                Used
   345678                New

After:

     A         B         c
   123456   N123456     New
   234657   U234567     Used
   345678   N345678     New

Upvotes: 2

Views: 350

Answers (3)

Forward Ed
Forward Ed

Reputation: 9894

In the case where its not a matter of IF in column C but just whatever the first letter of column C is, drop the IF portion and go straight to the concatenation.

=LEFT(C1)&A1

Upvotes: 4

tigeravatar
tigeravatar

Reputation: 26660

Alternate:

=IF(OR(C1={"New","Used"}),LEFT(C1)&A1,"")

Upvotes: 2

BruceWayne
BruceWayne

Reputation: 23285

Assuming there are only New and Used, this can go in B1 and drag down.

=IF(C1="New","N"&A1,"U"&A1)

If there are other options, then you can use this one:

=IF(C1="New","N"&A1,IF(C1="Used","U"&A1,""),"")

Upvotes: 2

Related Questions