+ Reply to Thread
Results 1 to 7 of 7

Pre-Populate based on other inputs

  1. #1
    Forum Contributor
    Join Date
    08-16-2012
    Location
    Sefton
    MS-Off Ver
    Microsoft 365 Apps for enterprise
    Posts
    158

    Pre-Populate based on other inputs

    Example.xlsx

    Using the attached example, i would like the table on the right (Eqpt + ID#) to pre-populate based on the inputs in columns A-F (at the moment there is no formula, it's all manually entered)
    The number of inputs could vary, and may not always be in numeric order of columns A-F (there should only be numeric values entered).
    A (TA) up to 24 separate inputs
    B (PU) up to 24 separate inputs (either single numbers or pairs)
    C (FI) up to 10 separate inputs
    D (VE) up to 4 separate inputs
    E (LC) up to 2 separate inputs
    F (OS) up to 2 separate inputs

    I would like to make it so that the table on the right ignores any blanks (as shown in the examples)

  2. #2
    Forum Guru Kaper's Avatar
    Join Date
    12-14-2013
    Location
    Warsaw, Poland
    MS-Off Ver
    most often: Office 365 in Windows environment
    Posts
    8,862

    Re: Pre-Populate based on other inputs

    I think that a formula would be quite complicated, while macro works quick and is easy to read:

    Please Login or Register  to view this content.
    if you want not only valuees but also formatting then instead of
    Please Login or Register  to view this content.
    use
    Cells(1, i).copy Cells(k, "H")
    Cells(j, i).copy Cells(k, "I")
    Attached Files Attached Files
    Last edited by Kaper; 02-24-2014 at 09:59 AM.
    Best Regards,

    Kaper

  3. #3
    Forum Expert
    Join Date
    04-22-2013
    Location
    .
    MS-Off Ver
    .
    Posts
    4,418

    Re: Pre-Populate based on other inputs

    An alternative formula approach:
    =INDEX($A$1:$F$1,7-MATCH(ROW(A1),SUBTOTAL(3,OFFSET($A$2:$A$7,0,0,6,7-COLUMN($A$1:$F$1))),-1))
    in H2 as an array formula (confirm with ctrl+shift+enter)
    and
    =HLOOKUP(H2,A$1:F$7,COUNTIF($H$1:H1,H2)+2,0)
    in I2

    then copy down

  4. #4
    Forum Contributor
    Join Date
    08-16-2012
    Location
    Sefton
    MS-Off Ver
    Microsoft 365 Apps for enterprise
    Posts
    158

    Re: Pre-Populate based on other inputs

    @Kaper & @ragulduy

    Thanks for the replies, i 'll let you know when i've had a chance to test this. It's for work and i've just been given another task to do.

  5. #5
    Forum Contributor
    Join Date
    08-16-2012
    Location
    Sefton
    MS-Off Ver
    Microsoft 365 Apps for enterprise
    Posts
    158

    Re: Pre-Populate based on other inputs

    @Kaper & @ragulduy
    Thanks, those do both work. However (and this is my fault) only in the format i made the example sheet in. I really thought i'd be able to modify the response to the actual document. Could you have another look it this example for me and see if it can be done?
    Example.xlsx

    @Kaper - I need the macro to run automatically once data has been entered, is this possible? The people filling in the information will most likely not know how to run it manually.

    @ragulduy - your formula only includes the information i provided in the example - as mentioned in my initial post there can be up to 24 entries in PU and TA. I assume this can be done by substituting the "7" in your formula, however with the layout of the new example will this affect the rest?
    Last edited by DHFE; 03-03-2014 at 10:45 AM.

  6. #6
    Forum Expert
    Join Date
    04-22-2013
    Location
    .
    MS-Off Ver
    .
    Posts
    4,418

    Re: Pre-Populate based on other inputs

    Hi:

    Looking at the formula in H2 first:
    =INDEX($A$1:$F$1,7-MATCH(ROW(A1),SUBTOTAL(3,OFFSET($A$2:$A$7,0,0,6,7-COLUMN($A$1:$F$1))),-1))

    A1:F1 is to do with column headers, index(a,b) finds the bth term of the range a. So the 7-Match part is to do with columns. As Is the 7-column(A1:F1) part. The two parts relating to rows are in the offset function, the A2:A7 is the initial range and 6 is the number of rows, so for example, if your range went from A2:A14, the formula would become:
    =INDEX($A$1:$F$1,7-MATCH(ROW(A1),SUBTOTAL(3,OFFSET($A$2:$A$14,0,0,13,7-COLUMN($A$1:$F$1))),-1))
    Where A2:A14 is the range and 13 is the number of rows in the range.

    The holookup is a bit easier, you just need to change the lookup range, so for 14 rows
    =HLOOKUP(H2,A$1:F$8,COUNTIF($H$1:H1,H2)+2,0)
    would become
    =HLOOKUP(H2,A$1:F$14,COUNTIF($H$1:H1,H2)+2,0)

    Unforunately, this approach is based on your data being in a table on one sheet as you have in your first workbook. Once each heading is moved onto different sheets, I don't think it would be possible to adapt it. You would need to build the table from the data on the separate worksheets first.

  7. #7
    Forum Contributor
    Join Date
    08-16-2012
    Location
    Sefton
    MS-Off Ver
    Microsoft 365 Apps for enterprise
    Posts
    158

    Re: Pre-Populate based on other inputs

    I suppose I could use a hidden part of the sheet to build the data from the separate ones onto a single page and then use your formula.

    Thanks for the help.

  8. #8
    Forum Contributor
    Join Date
    08-16-2012
    Location
    Sefton
    MS-Off Ver
    Microsoft 365 Apps for enterprise
    Posts
    158

    Re: Pre-Populate based on other inputs

    EDIT:
    sorry for the double post, something strange happened to my browser.

+ 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. [SOLVED] Values based on three inputs
    By sha123 in forum Excel Formulas & Functions
    Replies: 25
    Last Post: 01-31-2014, 01:47 PM
  2. [SOLVED] Values based on two inputs
    By sha123 in forum Excel Formulas & Functions
    Replies: 2
    Last Post: 01-24-2014, 01:02 PM
  3. Replies: 1
    Last Post: 08-20-2013, 06:50 AM
  4. Excel 2007 : Finding a value based on 2 inputs
    By maxcavalli in forum Excel General
    Replies: 4
    Last Post: 08-10-2011, 12:47 PM
  5. Populate table based on 3 inputs
    By Senthilerp in forum Excel Programming / VBA / Macros
    Replies: 1
    Last Post: 08-19-2009, 04:16 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