Still celebrating National IT Professionals Day with 3 months of free Premium Membership. Use Code ITDAY17

x
?
Solved

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

Posted on 2013-12-31
7
Medium Priority
?
88,355 Views
Last Modified: 2016-08-29
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
0
Comment
Question by:BSAS_ITGuy
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
7 Comments
 
LVL 19

Accepted Solution

by:
Raheman M. Abdul earned 880 total points
ID: 39748388
Formula in F2 is

=IF(B2="X",C2,"")
0
 
LVL 2

Expert Comment

by:Ned_LeB
ID: 39748397
You wan to COPY the data or you just want the value to show in that cell?  Copying a cell is a VBA thing which is a bit more involved.  If you just want to show the value used this:

=IF(OR(B15="x",B15="X"),C15,"")
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,"")
1
 
LVL 1

Author Closing Comment

by:BSAS_ITGuy
ID: 39748430
Good simple answer.
0
Industry Leaders: We Want Your Opinion!

We value your feedback.

Take our survey and automatically be enter to win anyone of the following:
Yeti Cooler, Amazon eGift Card, and Movie eGift Card!

 

Expert Comment

by:K R
ID: 41774779
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
0
 
LVL 2

Expert Comment

by:Ned_LeB
ID: 41774831
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.
0
 

Expert Comment

by:K R
ID: 41775242
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
0
 
LVL 2

Expert Comment

by:Ned_LeB
ID: 41775678
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
0

Featured Post

Office 365 Training for IT Pros

Learn how to provision tenants, synchronize on-premise Active Directory, implement Single Sign-On, customize Office deployment, and protect your organization with eDiscovery and DLP policies.  Only from Platform Scholar.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

I was prompted to write this article after the recent World-Wide Ransomware outbreak. For years now, System Administrators around the world have used the excuse of "Waiting a Bit" before applying Security Patch Updates. This type of reasoning to me …
We live in a world of interfaces like the one in the title picture. VBA also allows to use interfaces which offers a lot of possibilities. This article describes how to use interfaces in VBA and how to work around their bugs.
If you’ve ever visited a web page and noticed a cool font that you really liked the look of, but couldn’t figure out which font it was so that you could use it for your own work, then this video is for you! In this Micro Tutorial, you'll learn yo…
Have you created a query with information for a calendar? ... and then, abra-cadabra, the calendar is done?! I am going to show you how to make that happen. Visualize your data!  ... really see it To use the code to create a calendar from a q…

721 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question