+ Reply to Thread
Results 1 to 22 of 22

Fill Down Values in Column L:P

  1. #1
    Forum Contributor
    Join Date
    02-06-2013
    Location
    Maryland
    MS-Off Ver
    Excel 2010
    Posts
    1,000

    Fill Down Values in Column L:P

    1. Looking for formula to fill down/populate column L2:P46 using original data in column F:J.

    2. Formula will take into account Sales Office in column B, Sales Zip in Column C and Sales Person in column D

    3. Original data in column F:J. Sales Zip column is essential for this. We see that the original data has its data cover Sales Zip C2:C11 (1999 to 2001). The data in F2:F11 will be duplicated/repeated/copied down for the corresponding Sales office and Sales Person in column B and D respective. The data in G2:G11 will be duplicated/repeated/copied down for the corresponding Sales office and Sales Person in column B and D respective. For Position -1 in column H, if all values are zeros (0), the values to be copied down would be ones (1). if the values in Position-1 are all ones (1), values to be copied down would be zeros (0). Same logic is applicable to column I. For column J, it will always have ones and the values to be copied down will be zeros - see L2:P46 for desired outcome.

    See sample data.

    Thanks.
    Attached Files Attached Files
    Last edited by bjnockle; 09-17-2020 at 11:57 AM.

  2. #2
    Banned User!
    Join Date
    02-06-2020
    Location
    Iowa City, IA, USA
    MS-Off Ver
    2016 - 365 / 2007
    Posts
    2,014

    Re: Formula to Fill Down Values in Column

    Quote Originally Posted by bjnockle View Post
    The data in G2:G11 will be duplicated/repeated/copied down for the corresponding Sales office and Sales Person in column B and D respective. For Position -1 in column H, if all values are zeros (0), the values to be copied down would be ones (1). if the values in Position-1 are all ones (1), values to be copied down would be zeros (0). Same logic is applicable to column I. For column J, it will always have ones and the values to be copied down will be zeros.
    just based on those words from you, I would assume you could make use of all of these if you looked up the concepts (which take just a second):

    => using the autofill handle
    => the IF() function
    => pasteSpecial function and paste values only by way of right clicking mouse

  3. #3
    Forum Contributor
    Join Date
    02-06-2013
    Location
    Maryland
    MS-Off Ver
    Excel 2010
    Posts
    1,000

    Re: Formula to Fill Down Values in Column

    vba_php: looking for a formula to automate the original file. It is over 200,000 datasets. Thanks.

  4. #4
    Banned User!
    Join Date
    02-06-2020
    Location
    Iowa City, IA, USA
    MS-Off Ver
    2016 - 365 / 2007
    Posts
    2,014

    Re: Fill Down Values in Column L:P

    Quote Originally Posted by bjnockle View Post
    1. Looking for formula to fill down/populate column L2:P46 using original data in column F:J.

    2. Formula will take into account Sales Office in column B, Sales Zip in Column C and Sales Person in column D
    your 2 points, 1 and 2 above make good sense, however the information you provided is very limited in terms of specifics. point #3, which I did not quote, is more detailed, however it is still a little unclear.

    I have now looked at your file, but that does not help provide anything close to an answer. based on everything I've read from you, once again, I would suggest you look up the concepts I outlined in my original reply to you and attempt a solution yourself. You would benefit greatly, as everyone here would too, and it would give people here a better understanding of how to guide you in this little journey of finding a solution based on what you attempt and/or where you get stuck in the process.

  5. #5
    Forum Contributor
    Join Date
    02-06-2013
    Location
    Maryland
    MS-Off Ver
    Excel 2010
    Posts
    1,000

    Re: Fill Down Values in Column L:P

    vba_php:
    1. I will start with Sales Zip in Column C. The Sales Zip is from C2:C46).

    2a. For this sample file, you will notice that C2:C11 has Sales Zip data from 1999-2001. See below.
    Please Login or Register  to view this content.
    2b. The corresponding data for this Sales Zip is in F2:J11. See below.
    Please Login or Register  to view this content.
    2c. For column F2:F11, the formula will match each Sales Office data (B2:B11) to the corresponding value in column F2:F11. Each value will be populated for Zip Code 2002 to 2013 (C12:C46) by taking into account Sales Office column as well the Sales Person in column D (reason - there are several sales person in the original file. Only used Ben Eric in this sample file).

    For example:
    B2 (Sales Office - part of pull formula requirements) =10Com, D2= Ben, Eric and F2= 0.
    B10=10Com, D10= Ben, Eric and F10= -

    Formula: should be setup to return F2 = 0 for L10 =0. Reason being that it is the same Sales Office value. What this means is that all 10Com will be populated with zeros (0) from Zip Code 2002 to 2013 (C12:C46). Raw data is in A1:J46 and desired outcome is in L2:P46. Hope this helps.


    Thanks.

  6. #6
    Banned User!
    Join Date
    02-06-2020
    Location
    Iowa City, IA, USA
    MS-Off Ver
    2016 - 365 / 2007
    Posts
    2,014

    Re: Fill Down Values in Column L:P

    well I'm sorry BJ, but I really did not follow anything that you said. I see the input ranges you are talking about, and the output ranges. However, some of the terms you are using to describe your data is part of the confusion here. for instance, you say zip code. however, the title of the column is sales zip! a zip code is a 5 digit number to describe a locale on the USA map! LOL.

    I will give this one more try. how about this? please answer the following questions, and that will help me understand what you're doing, why you're doing it, and the business you're in and how this whole solution you are looking for will help you go on successfully:

    => what business are you in? (industry)
    => what is the definition of the following column names?
    • Agent (=0)?
    • Non-Agent (1)
    • Position-1
    • Position-2
    • Filled Position

    => the overall purpose of getting your solution
    => a list of ANY functions that you know of, in Excel, that you are going to need to accomplish this goal.
    => EVERY piece of data (column names) that has to be used as inputs for formulas that are meant to be written in the following columns:
    • Agent (=0)?
    • Non-Agent (1)
    • Position-1
    • Position-2
    • Filled Position

    I realize you have already *partially* described these things, but I want 1-2 word definitions and *purposes* of these data columns. thanks.
    Last edited by vba_php; 09-18-2020 at 08:43 PM.

  7. #7
    Forum Contributor
    Join Date
    02-06-2013
    Location
    Maryland
    MS-Off Ver
    Excel 2010
    Posts
    1,000

    Re: Fill Down Values in Column L:P

    vba_php:

    However, some of the terms you are using to describe your data is part of the confusion here. for instance, you say zip code. however, the title of the column is sales zip! a zip code is a 5 digit number (Yes, I am aware. Remember, this is a dummy data. I made up the title. Actual title is year). to describe a locale on the USA map! LOL.

    => what business are you in? (industry)
    => what is the definition of the following column names?
    Agent (=0)? - Same as Sales Agent
    Non-Agent (1) - Same as Non-Sales Agent
    Position-1 - Sales Agent Position
    Position-2 - Sales Agent Position
    Filled Position - Is Sales Agent Position Filled?

  8. #8
    Forum Expert
    Join Date
    10-15-2018
    Location
    MA, USA
    MS-Off Ver
    2010, 2019
    Posts
    1,616

    Re: Fill Down Values in Column L:P

    The following solution matches your expected results.

    One note, you say: "For Position -1 in column H, if all values are zeros (0), the values to be copied down would be ones (1). if the values in Position-1 are all ones (1), values to be copied down would be zeros (0)." You don't specify what happens if there is a mix of ones and zeros, so I simply checked against one value (H2).

    Formulas in row 12 and copied down:
    F12: =IFERROR(INDEX(F$2:F$11, MATCH($B12&$D12, $B$2:$B$11&$D$2:$D$11, 0)), "-")
    G12: =IFERROR(INDEX(G$2:G$11, MATCH($B12&$D12, $B$2:$B$11&$D$2:$D$11, 0)), "-")
    H12: =IF(F12="-", "-", --($H$2=0))
    I12: =IF(G12="-", "-", --($H$2=0))
    J12: =IF(F12="-", "-", 0)
    The F12 & G12 formulas are array formulas and must be committed via CTRL-SHIFT-Enter

    Attached is your workbook with the above implemented.

    Hopefully this is what you are looking for, let us know.
    Attached Files Attached Files
    Geoff

    Did I help significantly? If you wish, click on * Add Reputation to say thanks.
    If your problem has been resolved please select ?Solved? from the Thread Tools menu

  9. #9
    Banned User!
    Join Date
    02-06-2020
    Location
    Iowa City, IA, USA
    MS-Off Ver
    2016 - 365 / 2007
    Posts
    2,014

    Re: Fill Down Values in Column L:P

    I'm a little disappointed that someone else has provided a supposed solution to this, given that I spent time with this thread. However, everyone can obviously contribute wherever they want, so I don't mind of course. Nice, Geoff. I'm not a function expert, as I've said many times, so I hope what you've got is something he can use. and since you now posted, I will stop. thanks.

  10. #10
    Forum Contributor
    Join Date
    02-06-2013
    Location
    Maryland
    MS-Off Ver
    Excel 2010
    Posts
    1,000

    Re: Fill Down Values in Column L:P

    GeoffW283: Outstanding approach.

    Formulas in row 12 and copied down:
    F12: =IFERROR(INDEX(F$2:F$11, MATCH($B12&$D12, $B$2:$B$11&$D$2:$D$11, 0)), "-") - This formula should be placed in L2 not F12 as implemented in your sample file. Desired Output is in L2:P46. A2:J46 is the raw data (formula will never be placed here).
    When I adjusted the formula for Agent (=0)? Non-Agent (1), it worked. See adjusted formula below.
    Please Login or Register  to view this content.

    G12: =IFERROR(INDEX(G$2:G$11, MATCH($B12&$D12, $B$2:$B$11&$D$2:$D$11, 0)), "-")- This formula should be placed in M2 not G12 as implemented in your sample file. Desired Output is in L2:P46. A2:J46 is the raw data (formula will never be placed here).
    When I adjusted the formula for Agent (=0)? Non-Agent (1), it worked. See adjusted formula below.
    Please Login or Register  to view this content.
    H12: =IF(F12="-", "-", --($H$2=0)) - NOT WORKING - SHOULD BE PLACED IN N2.
    I12: =IF(G12="-", "-", --($H$2=0)) - NOT WORKING - SHOULD BE PLACED IN O2.
    J12: =IF(F12="-", "-", 0) - NOT WORKING - SHOULD BE PLACED IN P2.

    See attached file.


    The F12 & G12 formulas are array formulas and must be committed via CTRL-SHIFT-Enter
    Attached Files Attached Files

  11. #11
    Forum Expert
    Join Date
    10-15-2018
    Location
    MA, USA
    MS-Off Ver
    2010, 2019
    Posts
    1,616

    Re: Fill Down Values in Column L:P

    No problem, glad to help - thanks for the feedback.

  12. #12
    Forum Contributor
    Join Date
    02-06-2013
    Location
    Maryland
    MS-Off Ver
    Excel 2010
    Posts
    1,000

    Re: Fill Down Values in Column L:P

    GeoffW283: Are you able to fix:

    H12: =IF(F12="-", "-", --($H$2=0)) - NOT WORKING - SHOULD BE PLACED IN N2.
    I12: =IF(G12="-", "-", --($H$2=0)) - NOT WORKING - SHOULD BE PLACED IN O2.
    J12: =IF(F12="-", "-", 0) - NOT WORKING - SHOULD BE PLACED IN P2.

    Thanks alot for your time with this.

  13. #13
    Forum Expert
    Join Date
    10-15-2018
    Location
    MA, USA
    MS-Off Ver
    2010, 2019
    Posts
    1,616

    Re: Fill Down Values in Column L:P

    Apologies, I didn't read your post #10 carefully enough. I stopped after "Outstanding approach"

    Please try the following:

    N2: =IF($L2="-", "-", --(H$2=0))
    O2: =IF($L2="-", "-", --(I$2=0))
    P2: =IF($L2="-", "-", 0)

    And copy down to row-46

    This matches your expected results I think. Hopefully it works for you - let us know if not.

  14. #14
    Forum Contributor
    Join Date
    02-06-2013
    Location
    Maryland
    MS-Off Ver
    Excel 2010
    Posts
    1,000

    Re: Fill Down Values in Column L:P

    GeoffW283: Thanks a lot for looking at this. it is still not providing the right outcome.

    For Position -1 in column H, if all values are zeros (0), the values to be copied down would be ones (1). if the values in Position-1 are all ones (1), values to be copied down would be zeros (0). Same logic is applicable to column I. For column J, it will always have ones and the values to be copied down will be zeros - see L2:P46 for desired outcome.

    N2: =IF($L2="-", "-", --(H$2=0)) - H$2=0 should be L2. The formula is not providing the right outcome. Please review attached file.
    O2: =IF($L2="-", "-", --(I$2=0)) - The formula is not providing the right outcome.
    P2: =IF($L2="-", "-", 0) The formula is not providing the right outcome.
    Attached Files Attached Files

  15. #15
    Forum Expert
    Join Date
    10-15-2018
    Location
    MA, USA
    MS-Off Ver
    2010, 2019
    Posts
    1,616

    Re: Fill Down Values in Column L:P

    For ease of comparing what my formulas give in L:P to your expected results I have copied your expected results to R:V and then in W:AA I have flagged with an "F" where my formula and your expected results differ. In summary:

    Row-18 Office "Inter" - you show "-", I show values.

    Row-24, 28, 32 and so on: office "SVBFG" - you show "-", I show values.

    If this is a problem please explain how it should be fixed.

    Formulas:
    N2: =IF($L2="-", "-", IF(ISNUMBER(H2), H2,--(H$2=0)))
    O2: =IF($L2="-", "-", IF(ISNUMBER(I2), I2,--(I$2=0)))
    P2: =IF($L2="-", "-", IF(ISNUMBER(J2), J2, 0))

    Hopefully We're getting closer. Let us know.

    Updated workbook attached
    Attached Files Attached Files

  16. #16
    Forum Contributor
    Join Date
    02-06-2013
    Location
    Maryland
    MS-Off Ver
    Excel 2010
    Posts
    1,000

    Re: Fill Down Values in Column L:P

    GeoffW283: Thanks for proposing the above formula. Still not working. I added more data and is not pulling correctly. See expected results in column R - V. See attached sample file.

    Thanks
    Attached Files Attached Files

  17. #17
    Forum Contributor
    Join Date
    02-06-2013
    Location
    Maryland
    MS-Off Ver
    Excel 2010
    Posts
    1,000

    Re: Fill Down Values in Column L:P

    Geoffw283: All proposed formula not working correctly. Please see attached file for your review. Thanks a lot.

  18. #18
    Forum Expert
    Join Date
    10-15-2018
    Location
    MA, USA
    MS-Off Ver
    2010, 2019
    Posts
    1,616

    Re: Fill Down Values in Column L:P

    Sorry, I haven't been ignoring you. I think I understand now what you are looking for. Unfortunately, despite a fair amount of effort I just can't see a solution so far.

    I'll keep at it but I'm also going to try to see if there's someone else willing to try.

    The attachment is the same as your post #16 attachment except that I copied down the column W:AA error flags to the end of the data for the convenience of anyone else who wants to look at this.
    Attached Files Attached Files

  19. #19
    Forum Contributor
    Join Date
    02-06-2013
    Location
    Maryland
    MS-Off Ver
    Excel 2010
    Posts
    1,000

    Re: Fill Down Values in Column L:P

    GeoffW283: Will i get a solution if I move it to the Commercial Services section? Thanks a lot for your effort thus far.

  20. #20
    Forum Expert bebo021999's Avatar
    Join Date
    07-22-2011
    Location
    Vietnam
    MS-Off Ver
    Excel 2016
    Posts
    9,466

    Re: Fill Down Values in Column L:P

    I came up with 99% matching your goal in column R:V, except
    Row 64-68
    I interprete the algorithm of column L (Agent=0) as follow:

    L64:
    =IF($F64<>"",$F64,IFERROR(LOOKUP(2,1/($B$1:$B63=$B64)/($D$1:$D63=$D64),L$1:L63),"-"))

    1) =IF($F64<>"",$F64,
    If column F has been updated, get new value from column F
    2) else, search for the latest sales Office&Sales person (row 60), then get the coresponding value in column F

    It is OK till row 63, but for 64:68, it fails.

    Does it break your logic, or your typo in expected result?
    Attached Files Attached Files
    Quang PT

  21. #21
    Forum Contributor
    Join Date
    02-06-2013
    Location
    Maryland
    MS-Off Ver
    Excel 2010
    Posts
    1,000

    Re: Fill Down Values in Column L:P

    bebo021999: I have updated your attached file with what I think the right formula should be in column M
    Please Login or Register  to view this content.
    Please review and let me know what you think. Thanks.
    Attached Files Attached Files

  22. #22
    Forum Contributor
    Join Date
    02-06-2013
    Location
    Maryland
    MS-Off Ver
    Excel 2010
    Posts
    1,000

    Re: Fill Down Values in Column L:P

    bebo021999: Proposed formula
    Please Login or Register  to view this content.
    is crashing my actual file because of the datasets (over 200,000 rows). Any fix to this? Thanks

+ 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. How do I colour fill cells in Column A based on values in Column B
    By bearcovier in forum Excel Formulas & Functions
    Replies: 2
    Last Post: 10-17-2019, 08:12 AM
  2. Replies: 8
    Last Post: 07-04-2018, 10:03 AM
  3. [SOLVED] Fill up a column in one work sheet by matching column values in 2 worksheets
    By marimuthuravi in forum Excel Formulas & Functions
    Replies: 2
    Last Post: 06-11-2018, 11:38 PM
  4. [SOLVED] How to fill an array with values in column C based on Column D date value of Today
    By jrtraylor in forum Excel Programming / VBA / Macros
    Replies: 9
    Last Post: 01-10-2016, 07:44 PM
  5. [SOLVED] Find Values in Column A and fill identical values in Column B
    By deviltronics in forum Excel General
    Replies: 6
    Last Post: 10-07-2014, 05:25 PM
  6. [SOLVED] vba to fill values till end of text values in B:B column.
    By johnodys in forum Excel Programming / VBA / Macros
    Replies: 4
    Last Post: 05-28-2014, 03:06 AM
  7. Replies: 1
    Last Post: 09-07-2011, 05:57 PM

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