+ Reply to Thread
Results 1 to 12 of 12

If Bx is empty and Ax = Az -> fill Bx with contents of Bz

  1. #1
    Registered User
    Join Date
    06-28-2013
    Location
    United States
    MS-Off Ver
    Excel 2010
    Posts
    9

    If Bx is empty and Ax = Az -> fill Bx with contents of Bz

    I've got a strange CSV export of products setup like this:Demo Spreadsheet.xlsx

    Column A: Product Handle (Arbitrary)
    Column B: Product Name
    Column C: Attribute Name

    However because of how the document was setup Column B is ONLY FILLED for the first attribute in each product, and the number of attributes is not constant.
    What I want to is fill Column B for the entire document, so I need something setup like this:

    (x and y are rows)
    If Bx is empty AND Ax = Az AND Bz is NOT empty -> fill Bx with By

    Any suggestions.

    Thanks,

    Jared

  2. #2
    Forum Expert newdoverman's Avatar
    Join Date
    02-07-2013
    Location
    Port Dover, Ontario, Canada
    MS-Off Ver
    2010
    Posts
    10,330

    Re: If Bx is empty and Ax = Az -> fill Bx with contents of Bz

    I copied the "Handle" to a new spot on the worksheet and using the Data tab Remove Duplicates removed all duplicates then added the Product Name to the appropriate "Handle".

    You say that the Handles are arbitrary. If they are a consistent match with the Product then what I have given you will work.
    Attached Files Attached Files
    <---------If you like someone's answer, click the star to the left of one of their posts to give them a reputation point for that answer.
    Ron W

  3. #3
    Registered User
    Join Date
    06-28-2013
    Location
    United States
    MS-Off Ver
    Excel 2010
    Posts
    9

    Re: If Bx is empty and Ax = Az -> fill Bx with contents of Bz

    Quote Originally Posted by newdoverman View Post
    I copied the "Handle" to a new spot on the worksheet and using the Data tab Remove Duplicates removed all duplicates then added the Product Name to the appropriate "Handle".

    You say that the Handles are arbitrary. If they are a consistent match with the Product then what I have given you will work.
    I'm not quiet clear on what duplicates you removed since the attributes are all unique?

    You are correct that the handle is a consistent match with the product.

    What I'm looking for is to have the Product column filled out for every attribute.

    -Jared

  4. #4
    Forum Expert newdoverman's Avatar
    Join Date
    02-07-2013
    Location
    Port Dover, Ontario, Canada
    MS-Off Ver
    2010
    Posts
    10,330

    Re: If Bx is empty and Ax = Az -> fill Bx with contents of Bz

    When you copy the "Handle" list the list is:

    D8KV
    D8KV
    D8KV
    D8KV
    V9IK
    V9IK
    L7DF
    L7DF
    L7DF
    L7DF
    L7DF
    L7DF
    K5JI
    K5JI
    K5JI


    There are many repeats in that list. With duplicates removed, the list becomes:

    D8KV
    V9IK
    L7DF
    K5JI


    Then with the product added the vlookup range addressed in the formula will look like this:

    D8KV Chevy
    V9IK Ford
    L7DF Dodge
    K5JI Jeep

  5. #5
    Registered User
    Join Date
    06-28-2013
    Location
    United States
    MS-Off Ver
    Excel 2010
    Posts
    9

    Re: If Bx is empty and Ax = Az -> fill Bx with contents of Bz

    But then I loose all my attributes. If I wanted a list with the attributes removed I could just reverse sort by Product Name and delete everything below.

    I'm looking for a list that has the Product Name on every line with an Attribute Name.

    Quote Originally Posted by newdoverman View Post
    When you copy the "Handle" list the list is:

    D8KV
    D8KV
    D8KV
    D8KV
    V9IK
    V9IK
    L7DF
    L7DF
    L7DF
    L7DF
    L7DF
    L7DF
    K5JI
    K5JI
    K5JI


    There are many repeats in that list. With duplicates removed, the list becomes:

    D8KV
    V9IK
    L7DF
    K5JI


    Then with the product added the vlookup range addressed in the formula will look like this:

    D8KV Chevy
    V9IK Ford
    L7DF Dodge
    K5JI Jeep

  6. #6
    Forum Expert XOR LX's Avatar
    Join Date
    04-18-2013
    Location
    Turin, Italy
    MS-Off Ver
    Office 365
    Posts
    7,742

    Re: If Bx is empty and Ax = Az -> fill Bx with contents of Bz

    Hi,

    Could you just explain a bit more your logical statement: "If Bx is empty AND Ax = Az AND Bz is NOT empty -> fill Bx with By"?

    I presume that x,y,z are supposed to indicate consecutive rows, but if I apply this statement to your attachment, I cannot return a single TRUE from this Boolean logic: for example, applied to cell B3 of your attachment, I have:

    If B3 is empty (TRUE) AND A3=A5 (TRUE) AND B5 is NOT empty (FALSE) = FALSE

    and so on.

    Regards
    Click * below if this answer helped

    Advanced Excel Techniques: http://excelxor.com/

  7. #7
    Registered User
    Join Date
    06-28-2013
    Location
    United States
    MS-Off Ver
    Excel 2010
    Posts
    9

    Re: If Bx is empty and Ax = Az -> fill Bx with contents of Bz

    Demo Spreadsheet GOAL.xlsxx, y and z are NOT consecutive. It is a difficult algorythm to write in boolean, I think it probably needs a loop to check the entire spreadsheet for a "sub-header row" which is the first row in a product, the only row that has the product name.

    I'm attaching what I'm looking for as the goal (end product).

    Hope that helps?

    -Jared

    Quote Originally Posted by XOR LX View Post
    Hi,

    Could you just explain a bit more your logical statement: "If Bx is empty AND Ax = Az AND Bz is NOT empty -> fill Bx with By"?

    I presume that x,y,z are supposed to indicate consecutive rows, but if I apply this statement to your attachment, I cannot return a single TRUE from this Boolean logic: for example, applied to cell B3 of your attachment, I have:

    If B3 is empty (TRUE) AND A3=A5 (TRUE) AND B5 is NOT empty (FALSE) = FALSE

    and so on.

    Regards

  8. #8
    Forum Expert newdoverman's Avatar
    Join Date
    02-07-2013
    Location
    Port Dover, Ontario, Canada
    MS-Off Ver
    2010
    Posts
    10,330

    Re: If Bx is empty and Ax = Az -> fill Bx with contents of Bz

    Did you look at column B in the sheet that I sent to you that had VLOOKUP formulae relating to the small table that looks like this?

    D8KV Chevy
    V9IK Ford
    L7DF Dodge
    K5JI Jeep


    The data in column B is drawn from this table using a VLOOKUP formula.

  9. #9
    Registered User
    Join Date
    06-28-2013
    Location
    United States
    MS-Off Ver
    Excel 2010
    Posts
    9

    Re: If Bx is empty and Ax = Az -> fill Bx with contents of Bz

    Perfect, thank you, VLOOKUP was exactly what I was looking for, much better to use a lookup table than try to write a loop function. I just had to be careful to define the lookup table by the entire column and NOT specify rows. Specifying rows caused the rows to increment as I dragged the formula down column B, which mean some of the table wasn't active for rows further down.

    Jared

    Quote Originally Posted by newdoverman View Post
    Did you look at column B in the sheet that I sent to you that had VLOOKUP formulae relating to the small table that looks like this?

    D8KV Chevy
    V9IK Ford
    L7DF Dodge
    K5JI Jeep


    The data in column B is drawn from this table using a VLOOKUP formula.

  10. #10
    Forum Expert newdoverman's Avatar
    Join Date
    02-07-2013
    Location
    Port Dover, Ontario, Canada
    MS-Off Ver
    2010
    Posts
    10,330

    Re: If Bx is empty and Ax = Az -> fill Bx with contents of Bz

    Thanks for the feedback.

  11. #11
    Registered User
    Join Date
    06-28-2013
    Location
    United States
    MS-Off Ver
    Excel 2010
    Posts
    9

    Re: If Bx is empty and Ax = Az -> fill Bx with contents of Bz

    You guys were great with my last question, maybe you can help with this related one:

    I've got a spreadsheet, first column is order numbers, second column is order items. If there is more than one item per order, the order number is repeated for each different item on another row. I would like one row per order with the order items separated by a comma in that one box.

    Suggestions?Orders Demo Spreadsheet.xlsx

  12. #12
    Forum Contributor arlu1201's Avatar
    Join Date
    09-09-2011
    Location
    Bangalore, India
    MS-Off Ver
    Excel 2003 & 2007
    Posts
    19,166

    Re: If Bx is empty and Ax = Az -> fill Bx with contents of Bz

    Since you marked this thread as solved already, its not likely to be noticed. Its better you create a new thread for your new question.
    If I have helped, Don't forget to add to my reputation (click on the star below the post)
    Don't forget to mark threads as "Solved" (Thread Tools->Mark thread as Solved)
    Use code tags when posting your VBA code: [code] Your code here [/code]

+ Reply to Thread

Thread Information

Users Browsing this Thread

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

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