+ Reply to Thread
Results 1 to 12 of 12

subtraction of vlookup in two sheets but across a number of columns

  1. #1
    Forum Contributor
    Join Date
    09-06-2011
    Location
    northern ireland
    MS-Off Ver
    Excel 365
    Posts
    180

    subtraction of vlookup in two sheets but across a number of columns

    hi,

    just entering a basic vlookup formula =vlookup(c306,C4:c297,20,0)-vlookup(c306,bc4:EA304,20,0)
    so rather than copy and paste this formula for the next column and move col 20 to 21 across all the columns, is there an easier formula where it will update once I drag the one formula across the columns ?

    Many thanks
    Leanne

  2. #2
    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
    81,064

    Re: subtraction of vlookup in two sheets but across a number of columns

    This can't work:

    =vlookup(c306,C4:c297,20,0)

    There is only one column in the array, not 20.

    We need clarity.

    There are instructions at the top of the page explaining how to attach your sample workbook.
    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.

  3. #3
    Forum Expert BadlySpelledBuoy's Avatar
    Join Date
    06-14-2013
    Location
    East Sussex, UK
    MS-Off Ver
    365
    Posts
    7,468

    Re: subtraction of vlookup in two sheets but across a number of columns

    If you replace the 20 in your formula with COLUMNS($A:T) it will increment as you drag to the right.

    Is that what you mean?

    Note there appears to be an error in your formula above as the first VLOOKUP is only looking at column C so it cannot return a value from the 20th column. I presume just a typo.

    BSB
    Last edited by BadlySpelledBuoy; 01-17-2021 at 08:55 AM.

  4. #4
    Forum Contributor
    Join Date
    09-06-2011
    Location
    northern ireland
    MS-Off Ver
    Excel 365
    Posts
    180

    Re: subtraction of vlookup in two sheets but across a number of columns

    Hi,

    20 refers to the column I am retrieving the data from, please see snippet, its a very basic example of what I am trying to do. I am looking up the employee no in the yellow range to populate the green cells from column 19 to 50 but I want Jan minus Dec.

    appreciate your help !

    Thanks
    Leanne

    Capturetest.JPG

  5. #5
    Forum Expert BadlySpelledBuoy's Avatar
    Join Date
    06-14-2013
    Location
    East Sussex, UK
    MS-Off Ver
    365
    Posts
    7,468

    Re: subtraction of vlookup in two sheets but across a number of columns

    Could you attach a workbook rather than a picture of one? Makes it much easier to help that way.

    If you include a few expected results too that would be brilliant.

    BSB

  6. #6
    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
    81,064

    Re: subtraction of vlookup in two sheets but across a number of columns

    @Leanne

    As I said, and BSB has also noted, this can't work:

    =vlookup(c306,C4:c297,20,0)

    There is only one column in the array, not 20.

    Please attach a sample workbook.

  7. #7
    Forum Contributor
    Join Date
    09-06-2011
    Location
    northern ireland
    MS-Off Ver
    Excel 365
    Posts
    180

    Re: subtraction of vlookup in two sheets but across a number of columns

    hey, sorry example spreadsheet attached, work computer wouldnt allow me to upload - please see attached
    Attached Files Attached Files

  8. #8
    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
    81,064

    Re: subtraction of vlookup in two sheets but across a number of columns

    Try this:

    =VLOOKUP($A9,$A$3:$AQ$6,COLUMNS($A:S),0)-VLOOKUP($A9,'DEC 20'!$A$3:$AQ$6,COLUMNS($A:S),0)

  9. #9
    Forum Contributor
    Join Date
    09-06-2011
    Location
    northern ireland
    MS-Off Ver
    Excel 365
    Posts
    180

    Re: subtraction of vlookup in two sheets but across a number of columns

    thank you so much - so if there is an employee in Jan tab but not in Dec tab I get an error, I still want to know what the result is ?
    Last edited by leanne2011; 01-17-2021 at 06:39 AM.

  10. #10
    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
    81,064

    Re: subtraction of vlookup in two sheets but across a number of columns

    Ok.

    =iferror(vlookup($a9,$a$3:$aq$6,columns($a:s),0),0)-iferror(vlookup($a9,'dec 20'!$a$3:$aq$6,columns($a:s),0),0)

  11. #11
    Forum Contributor
    Join Date
    09-06-2011
    Location
    northern ireland
    MS-Off Ver
    Excel 365
    Posts
    180

    Re: subtraction of vlookup in two sheets but across a number of columns

    absolutely perfect - sincere thanks and have a lovely day

  12. #12
    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
    81,064

    Re: subtraction of vlookup in two sheets but across a number of columns

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

    Also, you may not be aware that you can thank those who have helped you by clicking the small star icon located in the lower left corner of the post in which the help was given. By doing so you can add to the reputation(s) of those who helped.

+ 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. subtraction from two columns
    By rachnacare in forum Excel General
    Replies: 11
    Last Post: 02-08-2023, 01:46 AM
  2. Vlookup subtraction from a cell
    By damagas in forum Excel Formulas & Functions
    Replies: 11
    Last Post: 07-13-2021, 05:24 AM
  3. Inventory tracking - vlookup with subtraction from running total
    By jimslim66 in forum Excel Formulas & Functions
    Replies: 10
    Last Post: 03-31-2018, 05:05 PM
  4. Range Subtraction / Matrix Subtraction - Large data set
    By excelrabbit in forum Excel Programming / VBA / Macros
    Replies: 5
    Last Post: 11-20-2015, 07:07 AM
  5. [SOLVED] dont want subtraction if answer is -ve number
    By excellover2212 in forum Excel General
    Replies: 6
    Last Post: 04-30-2014, 07:14 AM
  6. VLookup and Subtraction for Inventory
    By michael.pietrafesa in forum Excel Formulas & Functions
    Replies: 2
    Last Post: 09-13-2012, 08:44 AM
  7. Subtraction of data and transfer to other sheets
    By lmtzprog in forum Excel Programming / VBA / Macros
    Replies: 0
    Last Post: 02-23-2010, 02:36 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