+ Reply to Thread
Results 1 to 8 of 8

Adding a VLOOKUP to an increasing / decreasing number of rows

  1. #1
    Registered User
    Join Date
    07-21-2018
    Location
    London
    MS-Off Ver
    2016
    Posts
    6

    Adding a VLOOKUP to an increasing / decreasing number of rows

    Hi there

    I wonder if you could please help me with my query regarding adding a VLOOKUP to rows of data that increase and decrease in number? The scenario is this - I have a bunch of data rows that pull down from a SQL Server view. On day 1 the total number of rows might be 30, then on day 2 it might be 50 then on day 3 it might be 35 etc. I need to put a VLOOKUP in column 2 on each row. That's all pretty straightforward!

    What I want to know is if it's possible to expand / reduce the cells containing the VLOOKUP depending on how many rows of data there are? So, what I'd like is something like this (i.e. I have 3 rows so the amount of VLOOKUPs in column 2 is 3).

    COLUMN1 COLUMN2
    ROW1 VLOOKUP
    ROW2 VLOOKUP
    ROW3 VLOOKUP

    What I don't want is this: (i.e. there are more VLOOKUPs in column 2 than there are bits of data in column 1)
    COLUMN1 COLUMN2
    ROW1 VLOOKUP
    ROW2 VLOOKUP
    ROW3 VLOOKUP
    VLOOKUP
    VLOOKUP

    So, in essence, I need a VLOOKUP against each row of data that exists. So, if there are 50 rows of data then I would need there to be 50 VLOOKUPs and if there's only 35 rows of data then I would need there to be 35 VLOOKUPs. However, I won't know from one day to the next how many rows will be required, so I need the amount of VLOOKUPs to be dynamic if that makes sense.

    Many thanks
    Jon

  2. #2
    Forum Moderator Glenn Kennedy's Avatar
    Join Date
    07-08-2012
    Location
    Digital Nomad... occasionally based in Ireland.
    MS-Off Ver
    O365 (PC) V 2403
    Posts
    44,053

    Re: Adding a VLOOKUP to an increasing / decreasing number of rows

    Will you please attach a SMALL sample Excel workbook (10-20 rows of data is usually enough)? Please don't attach a picture of one (no-one will want to re-type all your stuff before starting).

    1. Make sure that your sample data are truly REPRESENTATIVE of your real data. The use of unrepresentative data is very frustrating and can lead to long delays in reaching a solution.

    2. Make sure that your desired solution is also shown (mock up the results manually).

    3. Make sure that all confidential information is removed first!!

    4. Try to avoid using merged cells. They cause lots of problems!

    Unfortunately the attachment icon doesn't work at the moment. So, to attach an Excel file you have to do the following: Just before posting, scroll down to Go Advanced and then scroll down to Manage Attachments. Now follow the instructions at the top of that screen.
    Glenn




    None of us get paid for helping you... we do this for fun. So DON'T FORGET to say "Thank You" to all who have freely given some of their time to help YOU.

    Temporary addition of accented to illustrate ongoing problem to the TT: L? fh?ile P?draig sona dhaoibh

  3. #3
    Registered User
    Join Date
    07-21-2018
    Location
    London
    MS-Off Ver
    2016
    Posts
    6

    Re: Adding a VLOOKUP to an increasing / decreasing number of rows

    Hi Glenn

    Thanks for your reply.

    I have attached a sample as requested. So, the VLOOKUP is looking up from Sheet 2 which is good. However, Rows 10-18 on Sheet are
    showing N/A as there's nothing in Column A. This is what I'd like to avoid if possible.

    I'd like Column B to only have a VLOOKUP in it if there's something in Column A.

    Best wishes
    Jon

  4. #4
    Forum Moderator Glenn Kennedy's Avatar
    Join Date
    07-08-2012
    Location
    Digital Nomad... occasionally based in Ireland.
    MS-Off Ver
    O365 (PC) V 2403
    Posts
    44,053

    Re: Adding a VLOOKUP to an increasing / decreasing number of rows

    Your attachment didn't appear...

    Sounds like all you need is =IFERROR(your_vlookup_formula,"")

  5. #5
    Registered User
    Join Date
    07-21-2018
    Location
    London
    MS-Off Ver
    2016
    Posts
    6

    Re: Adding a VLOOKUP to an increasing / decreasing number of rows

    Thanks Glenn.

    However, when I input =IFERROR(VLOOKUP,A7,Sheet2!A6:B102,2,FALSE,"") into a cell I got an error saying that I'd input too many arguments.

  6. #6
    Forum Moderator Glenn Kennedy's Avatar
    Join Date
    07-08-2012
    Location
    Digital Nomad... occasionally based in Ireland.
    MS-Off Ver
    O365 (PC) V 2403
    Posts
    44,053

    Re: Adding a VLOOKUP to an increasing / decreasing number of rows

    =IFERROR(VLOOKUP(A7,Sheet2!A6:B102,2,FALSE),"")

    You left out the parentheses from your vlookup.

  7. #7
    Registered User
    Join Date
    07-21-2018
    Location
    London
    MS-Off Ver
    2016
    Posts
    6

    Re: Adding a VLOOKUP to an increasing / decreasing number of rows

    Ah yes, sorry! Many thanks for your help - this worked fine!

  8. #8
    Forum Moderator Glenn Kennedy's Avatar
    Join Date
    07-08-2012
    Location
    Digital Nomad... occasionally based in Ireland.
    MS-Off Ver
    O365 (PC) V 2403
    Posts
    44,053

    Re: Adding a VLOOKUP to an increasing / decreasing number of rows

    You're welcome.



    If that takes care of your original question, please select "Thread Tools" from the menu link above and mark this thread as SOLVED.

    It'd also be appreciated if you were to click the Add Reputation button at the foot of any of the posts of all members who helped you reach a solution.

+ 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. Extension to post--need help-increasing/decreasing
    By ZOHAR in forum Excel General
    Replies: 3
    Last Post: 05-25-2017, 03:10 AM
  2. [SOLVED] need help-increasing/decreasing
    By ZOHAR in forum Excel General
    Replies: 20
    Last Post: 05-08-2017, 09:02 PM
  3. [SOLVED] add shortcut for increasing decreasing decimal
    By ammartino44 in forum Excel General
    Replies: 8
    Last Post: 09-22-2015, 01:08 PM
  4. Decreasing and Increasing in excel 2007
    By BlessedChild42 in forum Excel - New Users/Basics
    Replies: 1
    Last Post: 12-27-2009, 12:47 AM
  5. increasing/decreasing by one
    By pagheca in forum Excel General
    Replies: 2
    Last Post: 05-14-2008, 04:57 AM
  6. increasing/decreasing; decreasing rate - problem
    By vasyuta in forum Excel General
    Replies: 0
    Last Post: 08-23-2006, 05:26 PM
  7. increasing and decreasing a value in a cell
    By cwal in forum Excel Formulas & Functions
    Replies: 6
    Last Post: 04-14-2006, 01:55 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