+ Reply to Thread
Results 1 to 9 of 9

Using SUM IF and VLOOKUP in one formula

  1. #1
    Registered User
    Join Date
    08-07-2013
    Location
    Texas
    MS-Off Ver
    Microsoft Office/Excel 2019 for Mac
    Posts
    39

    Using SUM IF and VLOOKUP in one formula

    I am sure this is just me not understanding where to put the parenthesis correctly but I am having a difficult time making this work.

    I use VLOOKUP because I always have the item# of the product in the left hand column
    For the most part these spreadsheets are always number values
    I like using IF so that I can return specific results if the product is or is not found
    Using the item# with VLOOKUP, I am pulling from a column of one spreadsheet 'Latest' and subtracting the value of whatever is in the column of another spreadsheet 'Previous'

    This is how I set it up, but it is not working -
    =SUM(IF((VLOOKUP($A3,Latest!$A:$BY,8,FALSE)="","",VLOOKUP($A3,Latest!$A:$BY,8,FALSE)))-(IF((VLOOKUP($A3,Previous!$A:$BY,8,FALSE)="","",VLOOKUP($A3,Previous!$A:$BY,8,FALSE)))

    I use these two formulas successfully so I am trying to combine the ideas:
    =IF(VLOOKUP($A3,Latest!$A:$BY,8,FALSE)="","",VLOOKUP($A3,Latest!$A:$BY,8,FALSE))
    =SUM((VLOOKUP($A3,Latest!$A:$BY,8,FALSE)-(VLOOKUP($A3,Previous!$A:$BY,8,FALSE))))

    For the end result, I want the cell value in the resulting worksheet to show as blank unless there is an actual value that would come from the SUM formula. I have way too many zeros and it makes it difficult to notice the the real changes in value

    Can anyone help me combine this to work?

  2. #2
    Forum Guru Pete_UK's Avatar
    Join Date
    12-31-2011
    Location
    Warrington, England
    MS-Off Ver
    Office 2019 (still learning)
    Posts
    25,434

    Re: Using SUM IF and VLOOKUP in one formula

    You don't say what you mean by "not working" - is it that you get a #VALUE or #NUM error? If so, that is because you are trying to use an arithmetic operation (i.e. minus) on a string value (i.e. ""). It might be better to have your IF function testing the result, and if it is zero then return blank (although zero might be a valid result).

    Hope this helps.

    Pete

  3. #3
    Registered User
    Join Date
    08-07-2013
    Location
    Texas
    MS-Off Ver
    Microsoft Office/Excel 2019 for Mac
    Posts
    39

    Re: Using SUM IF and VLOOKUP in one formula

    Not Working = Excel has a pop-up window that reads 'The Formula you typed contains an error'

    I am not thoroughly experienced in Excel formulas and learn each time I work on a new one, typically by learning from boards like this.

    I do not understand how to have the IF function test the result. If I am placing it in front of the SUM in the formula, how do I do this?

  4. #4
    Registered User
    Join Date
    08-07-2013
    Location
    Texas
    MS-Off Ver
    Microsoft Office/Excel 2019 for Mac
    Posts
    39

    Re: Using SUM IF and VLOOKUP in one formula

    Any other assistance?

  5. #5
    Forum Expert 63falcondude's Avatar
    Join Date
    08-22-2016
    Location
    USA
    MS-Off Ver
    365
    Posts
    6,266

    Re: Using SUM IF and VLOOKUP in one formula

    I recommend uploading a small representative sample of your data along with the desired results (which you can enter manually) based on that data.

    To upload an Excel workbook, follow these steps:
    1) Click on "Go Advanced"
    2) Click on "Manage Attachments"
    3) Click on "Choose File"
    4) Choose your file and click on "Open"
    5) Click on "Upload"
    6) Click on "Close this window"

  6. #6
    Registered User
    Join Date
    08-07-2013
    Location
    Texas
    MS-Off Ver
    Microsoft Office/Excel 2019 for Mac
    Posts
    39

    Re: Using SUM IF and VLOOKUP in one formula

    I uploaded the file, but I can't see where it lands in the message board.

    So, if looking on the Quick Ref tab, you can see in column Q and R the Y or N reference calculates wrong if the cell it is pulling from is blank. So R4 is showing Y, but it shouldn't because there is nothing in the cell that it is calculating from.
    Attached Files Attached Files

  7. #7
    Forum Expert 63falcondude's Avatar
    Join Date
    08-22-2016
    Location
    USA
    MS-Off Ver
    365
    Posts
    6,266

    Re: Using SUM IF and VLOOKUP in one formula

    This is a response to post #6 only.

    Try this in R2:

    =IF(AND(Z2>1,Z2<>""),"Y","N")

    Drag the formula down.

  8. #8
    Registered User
    Join Date
    08-07-2013
    Location
    Texas
    MS-Off Ver
    Microsoft Office/Excel 2019 for Mac
    Posts
    39

    Re: Using SUM IF and VLOOKUP in one formula

    And for the win.... thank you! I figured it was something simple but I was missing how to put it together.

  9. #9
    Forum Moderator AliGW's Avatar
    Join Date
    08-10-2013
    Location
    Retired in Ipswich, Suffolk, but grew up in Sawley, Derbyshire (both in England)
    MS-Off Ver
    MS 365 Subscription Insider Beta Channel v. 2505 (Windows 11 Home 24H2 64-bit)
    Posts
    91,301

    Re: Using SUM IF and VLOOKUP in one formula

    If that takes care of your original question, please select Thread Tools from the menu link above and mark this thread as SOLVED. Thanks.
    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. It's a universal courtesy.
    You can reward them by clicking on * Add Reputation below their user name on the left, if you wish.

    NB:
    as a Moderator, I never accept friendship requests.
    Forum Rules (updated August 2023): please read them here.

+ 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] VLOOKUP formula or VLOOKUP worksheet.function
    By Crispy85 in forum Excel Programming / VBA / Macros
    Replies: 5
    Last Post: 01-09-2017, 09:40 AM
  2. Replies: 5
    Last Post: 12-07-2016, 09:18 AM
  3. VBA external VLOOKUP instead of VLOOKUP-formula in cell
    By ExcelBonk in forum Excel Programming / VBA / Macros
    Replies: 3
    Last Post: 11-07-2016, 02:41 PM
  4. [SOLVED] Vlookup with column name instead of col_index_name(3rd Section of Vlookup formula)
    By akulka58 in forum Excel Formulas & Functions
    Replies: 10
    Last Post: 01-21-2014, 10:42 AM
  5. [SOLVED] VBA code for change vlookup formula to vlookup formula with ISNA
    By erprasannaa in forum Excel Programming / VBA / Macros
    Replies: 1
    Last Post: 02-12-2013, 03:33 AM
  6. Vlookup referencing a vlookup formula
    By laurenann in forum Excel General
    Replies: 1
    Last Post: 01-24-2011, 05:52 PM
  7. [SOLVED] vlookup-reate a vlookup formula?
    By Pam C in forum Excel General
    Replies: 1
    Last Post: 03-16-2006, 12:15 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