+ Reply to Thread
Results 1 to 16 of 16

Using SUMIFS combined with Vlookup - HELP!

  1. #1
    Registered User
    Join Date
    09-14-2021
    Location
    England
    MS-Off Ver
    MS365
    Posts
    68

    Post Using SUMIFS combined with Vlookup - HELP!

    Hi,

    I've been struggling with this formula for several hours and for some reason I can't get my head around it. If anyone could help it'd be greatly appreciated. I've created a simple version of the document: please see the summary below. As this is my first post it won't let me post a link so I've left the link here of the stack overflow post I've done. - stackoverflow.com/questions/69177321/excel-multi-layer-if-vlookup-and-formula

    There are 5 shops that all stock Apples, Pears, Bananas, and Oranges.

    Internally stock is moved and bought very regularly. Hence the 'Stock Location and Amount' Section. Below is the 'September Stock Movement' - which shows where the stock has moved to and from. There is also an option if more stock is bought or sold - from the bank.

    I need to create a formula that tracks the internal stock depending on the 'September Stock Movement' section - I've filled in some details to this section. If the formula in the 'Stock Location and Amount' section was complete then the data below would apply/work.

    If it's a transfer of stock then it needs to reduce one shop's stock and add to the other. If it's a buy then it just needs to add it directly to the location of the shop receiving the purchase and reduce the balance in the bank, and if it's a sell it needs to reduce the shops stock but increase the bank's balance.

    Note - the prices of the products are different.

    Please help - hugely appreciated.
    Attached Files Attached Files
    Last edited by zohan1; 09-14-2021 at 09:53 AM.

  2. #2
    Forum Moderator alansidman's Avatar
    Join Date
    02-02-2010
    Location
    Steamboat Springs, CO
    MS-Off Ver
    MS Office 365 Version 2404 Win 11 Home 64 Bit
    Posts
    23,860

    Re: Using SUMIFS combined with Vlookup - HELP!

    Fast answers need visual help. Please read the yellow banner at the top of this page on how to attach a file.
    Alan עַם יִשְׂרָאֵל חַי


    Change an Ugly Report with Power Query
    Database Normalization
    Complete Guide to Power Query
    Man's Mind Stretched to New Dimensions Never Returns to Its Original Form

  3. #3
    Registered User
    Join Date
    09-14-2021
    Location
    England
    MS-Off Ver
    MS365
    Posts
    68

    Re: Using SUMIFS combined with Vlookup - HELP!

    Thanks, Alan.

    Just posted the sheet.

    This, of course, is a very simplified version but once the formula works it'll apply directly over to the main document.

    Once again, any help is tremendously appreciated.

  4. #4
    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
    80,416

    Re: Using SUMIFS combined with Vlookup - HELP!

    There is no version 2021 - I assume you have MS365. Please update your forum profile accordingly.
    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.

  5. #5
    Registered User
    Join Date
    09-14-2021
    Location
    England
    MS-Off Ver
    MS365
    Posts
    68

    Re: Using SUMIFS combined with Vlookup - HELP!

    Done - wasn't sure what to put haha

  6. #6
    Forum Expert
    Join Date
    05-05-2015
    Location
    UK
    MS-Off Ver
    Microsoft Excel for Microsoft 365 MSO (Version 2402 Build 16.0.17328.20068) 64-bit
    Posts
    28,147

    Re: Using SUMIFS combined with Vlookup - HELP!

    I think (suspect) you need an "opening" stock for each product for each shop. Then use SUMIFS to calculate the stock movements.

    So "FROM" is a negative SUMIFS, "TO" a positive SUMIFS: so for any Shop/Product combination you have Current stock balance = Opening Balance + "To" SUMIFS -"From" SUMIFS

    Have I understood correctly and does the above fit with your requirement ?

  7. #7
    Registered User
    Join Date
    09-14-2021
    Location
    England
    MS-Off Ver
    MS365
    Posts
    68

    Re: Using SUMIFS combined with Vlookup - HELP!

    Thanks, John.

    If it isn't too much hassle would there be any chance you could provide an example formula to the above-attached sheet - I've spent hours writing formulas and I'm getting absolutely nowhere haha. - it's one of those days.

    Does that formula also include the buy/sell/transfer part?

    Any further help is super appreciated.

  8. #8
    Forum Expert
    Join Date
    05-05-2015
    Location
    UK
    MS-Off Ver
    Microsoft Excel for Microsoft 365 MSO (Version 2402 Build 16.0.17328.20068) 64-bit
    Posts
    28,147

    Re: Using SUMIFS combined with Vlookup - HELP!

    See attached.

    In C6

    Formula: copy to clipboard
    Please Login or Register  to view this content.


    Copy across to G and down to 9

    in C10 (corrected)

    =SUMIFS($D$18:$D$23,$B$18:$B$23,"Sell",$E$18:$E$23,C$5)-SUMIFS($D$18:$D$23,$B$18:$B$23,"Buy",$F$18:$F$23,C$5)

    Copy across

    in H6

    =SUMIFS($D$18:$D$23,$B$18:$B$23,"Sell",$C$18:$C$23,$A6)

    copy down
    Attached Files Attached Files
    Last edited by JohnTopley; 09-14-2021 at 11:41 AM.

  9. #9
    Forum Expert
    Join Date
    05-05-2015
    Location
    UK
    MS-Off Ver
    Microsoft Excel for Microsoft 365 MSO (Version 2402 Build 16.0.17328.20068) 64-bit
    Posts
    28,147

    Re: Using SUMIFS combined with Vlookup - HELP!

    Correction to H6

    =SUMIFS($D$18:$D$23,$B$18:$B$23,"Sell",$C$18:$C$23,$A6)-SUMIFS($D$18:$D$23,$B$18:$B$23,"Buy",$C$18:$C$23,$A6)

  10. #10
    Registered User
    Join Date
    09-14-2021
    Location
    England
    MS-Off Ver
    MS365
    Posts
    68

    Re: Using SUMIFS combined with Vlookup - HELP!

    You, my friend - are quite possibly the biggest lifesaver. This helps more than you can imagine! Thanks so much.

    Absolute legend!

    Works a dream!

  11. #11
    Forum Expert
    Join Date
    05-05-2015
    Location
    UK
    MS-Off Ver
    Microsoft Excel for Microsoft 365 MSO (Version 2402 Build 16.0.17328.20068) 64-bit
    Posts
    28,147

    Re: Using SUMIFS combined with Vlookup - HELP!

    You're vey welcome.

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

  12. #12
    Forum Expert
    Join Date
    05-05-2015
    Location
    UK
    MS-Off Ver
    Microsoft Excel for Microsoft 365 MSO (Version 2402 Build 16.0.17328.20068) 64-bit
    Posts
    28,147

    Re: Using SUMIFS combined with Vlookup - HELP!

    Shortened formula in C6

    Formula: copy to clipboard
    Please Login or Register  to view this content.

  13. #13
    Registered User
    Join Date
    09-14-2021
    Location
    England
    MS-Off Ver
    MS365
    Posts
    68

    Re: Using SUMIFS combined with Vlookup - HELP!

    Thanks, John.

    One final question (apologies) - the columns B6:B10 are meant to show the total amount of stock we have. Currently when doing a transaction, say Shop1 transfers 10 apples to Shop2, it shows Shop1 as being -10 and shop2 +10, meaning that the total stock summary has 0 apples rather than 10. What should I add to the formula so that if a number is negative it counts as 0.
    Assume it's an if statement - if you please help that'd be tremendous.

    Your help so far has been invaluable.

    Thanks again.

  14. #14
    Forum Expert
    Join Date
    05-05-2015
    Location
    UK
    MS-Off Ver
    Microsoft Excel for Microsoft 365 MSO (Version 2402 Build 16.0.17328.20068) 64-bit
    Posts
    28,147

    Re: Using SUMIFS combined with Vlookup - HELP!

    Try

    =SUMIF(C6:BB6,">0")

  15. #15
    Registered User
    Join Date
    09-14-2021
    Location
    England
    MS-Off Ver
    MS365
    Posts
    68

    Re: Using SUMIFS combined with Vlookup - HELP!

    In your shortened formula of C6 - This: =SUM(SUMIFS($D$18:$D$23,$C$18:$C$23,$A6,$F$18:$F$23,C$5,$B$18:$B$23,{"Transfer","Buy"}))-SUM(SUMIFS($D$18:$D$23,$C$18:$C$23,$A6,$E$18:$E$23,C$5,$B$18:$B$23,{"Transfer","Buy"}))

    Should it be "Sell" in the final part - {"Transfer","Sell"} ?

  16. #16
    Forum Expert
    Join Date
    05-05-2015
    Location
    UK
    MS-Off Ver
    Microsoft Excel for Microsoft 365 MSO (Version 2402 Build 16.0.17328.20068) 64-bit
    Posts
    28,147

    Re: Using SUMIFS combined with Vlookup - HELP!

    YES!! Sorry!

+ 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] Sumifs and Sum if Combined
    By MarkoGreenio in forum Excel Formulas & Functions
    Replies: 2
    Last Post: 08-03-2020, 06:27 AM
  2. [SOLVED] Sumifs and Offset Combined
    By MyStix01 in forum Excel General
    Replies: 7
    Last Post: 07-02-2019, 09:54 PM
  3. [SOLVED] Excel 2013: Need solution using VLOOKUP combined with SUMIFS or INDIRECT/MATCH
    By rarascon in forum Excel Formulas & Functions
    Replies: 6
    Last Post: 12-14-2018, 08:28 PM
  4. Combined Vlookup and SumIfs
    By Iappreciate in forum Excel Formulas & Functions
    Replies: 3
    Last Post: 12-27-2017, 08:07 PM
  5. Replies: 3
    Last Post: 01-29-2013, 01:30 PM
  6. Combined vlookup and sumifs in a single formula
    By mrexcelrc1 in forum Excel - New Users/Basics
    Replies: 1
    Last Post: 04-27-2012, 04:54 PM
  7. Combined SUMIFs
    By Mac Johnson in forum Access Tables & Databases
    Replies: 3
    Last Post: 03-19-2009, 06:11 AM

Tags for this Thread

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