BSAS_ITGuy

asked on

# Excel Formula: If Cell B equals X then copy Cell C

I need an excel formula that looks across a Row and evaluates if B:2 = x then copy the cell next to it C:2 into another cell F:2.

Example:

Department Paid Amount Date Late Removed

Accounting X 300 12/20/13 No $300-->>Copied from C

Example:

Department Paid Amount Date Late Removed

Accounting X 300 12/20/13 No $300-->>Copied from C

ASKER CERTIFIED SOLUTION

membership

This solution is only available to members.

To access this solution, you must be a member of Experts Exchange.

ASKER

Good simple answer.

What if I want to copy a string of outputs with commas in between but drop the comma if the first cell is blank

Eg If A2=x, to return the Initials in A1, and keep going across columns but to drop the relevant column if Row 2 is blank

Eg If A2=x, to return the Initials in A1, and keep going across columns but to drop the relevant column if Row 2 is blank

There and easy way (less elegant) and a harder way.

Easy, create a hidden row in row 3 (for this example) and use this formula:

In A3 cell:

=IF(A2="x",A1,"")

EDITED (Original was wrong)

In B2

=IF(B2="x",A3&", "&B1,A3)

Then copy and base B2 cell across all the column. If you have Z column the last cell Z3 should have all your data.

As for the hard way I would think of using matrix but I need to dig a bit for that one.

Let me know if what I mentioned here is enough. If not I'll look into matrix's.

I did not test this... if it does not work let me know and I'll debug it for you.

Easy, create a hidden row in row 3 (for this example) and use this formula:

In A3 cell:

=IF(A2="x",A1,"")

EDITED (Original was wrong)

In B2

=IF(B2="x",A3&", "&B1,A3)

Then copy and base B2 cell across all the column. If you have Z column the last cell Z3 should have all your data.

As for the hard way I would think of using matrix but I need to dig a bit for that one.

Let me know if what I mentioned here is enough. If not I'll look into matrix's.

I did not test this... if it does not work let me know and I'll debug it for you.

I think I follow but I need it to string a series of columns ideally with a comma when there is an initial, and to leave out the space and comma when there is no initial

Whereas the formula you've used will still give me a space between commas where there is no initial?

AB CD AD CC

x x x

AB AB AB, AB, AB, , CC

Whereas the formula you've used will still give me a space between commas where there is no initial?

AB CD AD CC

x x x

AB AB AB, AB, AB, , CC

It shouldn't I just tested it.

I attached an excel file with the formula.

AB CD AD CC DE FE YT

x x x x

AB AB AB, AD AB, AD AB, AD, DE AB, AD, DE AB, AD, DE, YT

example.xls

I attached an excel file with the formula.

AB CD AD CC DE FE YT

x x x x

AB AB AB, AD AB, AD AB, AD, DE AB, AD, DE AB, AD, DE, YT

example.xls

=IF(OR(B15="x",B15="X"),C1

If B15 is x or X then show the value in this cell, else show empty

Actually Excel is not case sensitive so this would work too.

=IF(B15="x",C15,"")