+ Reply to Thread
Results 1 to 8 of 8

Write in a cell IF a other cell is x

  1. #1
    Registered User
    Join Date
    06-09-2016
    Location
    Paris
    MS-Off Ver
    2011
    Posts
    52

    Post Write in a cell IF a other cell is x

    Hello,
    I'm finishing my database, and I need for that a function that I do not know. You can have a look to the table here, to make it clearer.
    My reference column is the last one. It's the one with the highest number of observation. Usually financer give money to parties, so that when you look "who gives money to candidate", you only see "parties". But actually, parties only transfer private money, that's why we need to look at the 3rd column. In 95% of cases, if in 3rd column we have #Nul, we got columns 1 = column 2. What I need is this: IF and onlyIF column 3 = #NUL, write down the valye of column 2 in a column, say, "4", if not, dont write anything (or write 0 and i'll delete 0). And after, concatenate column 4' and column 3 (original), to have a column with ALL the infos i need.
    How to write such a function ?
    thanks a lot ,
    Attached Files Attached Files

  2. #2
    Valued Forum Contributor
    Join Date
    01-08-2011
    Location
    Portsmouth, England
    MS-Off Ver
    Excel 2007 to 2016
    Posts
    456

    Re: Write in a cell IF a other cell is x

    I'm not sure I really understood your data as you mention Col 3 being #NUL but your example shows #NUL only in Col 4 (D).

    Anyway, you can do this in two steps or just one.

    To do in two steps, put this in "Formula with #NUL" (E on your sample)
    =IF(d2="#NUL","",C2)

    then this in the next column:
    =C2&E2

    You can do this in a single formula in your last column:
    =IF(D2="#NUL",C2,D2)

    of if you need to concatenate C and D:
    =IF(D2="#NUL",C2,C2&" "&D2)
    which will give a space between the two values.

    As I say, I wasn't sure exactly what you expected to see, but hopefully that gives you enough to get you started.
    Excel is a constant learning process and it's great to help each other. If any of us have helped you today, a click on the "reputation" star on the left is appreciated.

  3. #3
    Forum Moderator AliGW's Avatar
    Join Date
    08-10-2013
    Location
    Retired in Ipswich, Suffolk, but grew up in Sawley, Derbyshire (England)
    MS-Off Ver
    MS 365 Subscription Insider Beta Channel v. 2404 (Windows 11 22H2 64-bit)
    Posts
    80,916

    Re: Write in a cell IF a other cell is x

    Your post does not comply with Rule 8 of our Forum RULES. Do not crosspost your question on multiple forums without including links here to the other threads on other forums.

    Cross-posting is when you post the same question in other forums on the web. The last thing you want to do is waste people's time working on an issue you have already resolved elsewhere. We prefer that you not cross-post at all, but if you do (and it's unlikely to go unnoticed), you MUST provide a link (copy the url from the address bar in your browser) to the cross-post.

    Expect cross-posted questions without a link to be closed and a message will be posted by the moderator explaining why. We are here to help so help us to help you!

    Read this to understand why we ask you to do this, and then please edit your first post to include links to any and all cross-posts in any other forums (not just this site).
    Ali


    Enthusiastic self-taught user of MS Excel who's always learning!
    Don't forget to say "thank you" in your thread to anyone who has offered you help.
    You can reward them by clicking on * Add Reputation below their user name on the left, if you wish.

    Forum Rules (updated August 2023): please read them here.

  4. #4
    Registered User
    Join Date
    06-09-2016
    Location
    Paris
    MS-Off Ver
    2011
    Posts
    52

    Re: Write in a cell IF a other cell is x

    Thank you so much for your answer
    indeed, you are right about the data. I deleted a column to make it clearer, and you understood properly that the columns names are now obsolete in my message.
    I tried this:
    HTML Code: 
    but it gives me an error message on excel 2011 (mac). Why so ?

  5. #5
    Valued Forum Contributor
    Join Date
    01-08-2011
    Location
    Portsmouth, England
    MS-Off Ver
    Excel 2007 to 2016
    Posts
    456

    Re: Write in a cell IF a other cell is x

    Sorry, I don't have access to Mac so not sure why. You could try changing d2 to D2 - I don't know how sensitive Mac Excel is - Windows just changes references to capital letters when you press enter.

  6. #6
    Administrator FDibbins's Avatar
    Join Date
    12-29-2011
    Location
    Duncansville, PA USA
    MS-Off Ver
    Excel 7/10/13/16/365 (PC ver 2310)
    Posts
    52,938

    Re: Write in a cell IF a other cell is x

    Ayadin if you have x-posted on another forum (as Ali suggests, you are required to post a link to that post, pleasd
    1. Use code tags for VBA. [code] Your Code [/code] (or use the # button)
    2. If your question is resolved, mark it SOLVED using the thread tools
    3. Click on the star if you think someone helped you

    Regards
    Ford

  7. #7
    Registered User
    Join Date
    06-09-2016
    Location
    Paris
    MS-Off Ver
    2011
    Posts
    52

    Re: Write in a cell IF a other cell is x

    Indeed i did a mess, i thought it was the same forum : http://www.mrexcel.com/forum/excel-q...3D-if-not.html

    This is what I did finally and it worked:

    =IF(d2="#NUL"; ""; C2)

    thank you all

  8. #8
    Valued Forum Contributor
    Join Date
    01-08-2011
    Location
    Portsmouth, England
    MS-Off Ver
    Excel 2007 to 2016
    Posts
    456

    Re: Write in a cell IF a other cell is x

    Ah yes, I forget that in the European settings you have to use a semi-colon ; instead of a comma , in formulas

+ Reply to Thread

Thread Information

Users Browsing this Thread

There are currently 1 users browsing this thread. (0 members and 1 guests)

Similar Threads

  1. Replies: 4
    Last Post: 09-26-2015, 06:44 PM
  2. Find cell with text, offset to the left one cell and write code
    By timas in forum Excel Programming / VBA / Macros
    Replies: 10
    Last Post: 07-23-2015, 01:22 AM
  3. If cell change Then write in next empty cell in b column from B3:B200
    By lafanker in forum Excel Programming / VBA / Macros
    Replies: 0
    Last Post: 09-03-2014, 12:17 AM
  4. Userform Find Cell From ComboBox Value And Write To Adjacent Cell
    By pferder in forum Excel Programming / VBA / Macros
    Replies: 9
    Last Post: 04-07-2014, 09:05 PM
  5. Replies: 12
    Last Post: 04-25-2013, 04:10 AM
  6. Replies: 1
    Last Post: 04-19-2013, 12:44 AM
  7. [SOLVED] Code to evaluate contents of one cell then write new values into new cell (Simple IF Stmt)
    By clemsoncooz in forum Excel Programming / VBA / Macros
    Replies: 2
    Last Post: 07-05-2012, 11:54 AM

Bookmarks

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts

Search Engine Friendly URLs by vBSEO 3.6.0 RC 1