+ Reply to Thread
Results 1 to 10 of 10

Calculating Values depending on Variable Suppliers

  1. #1
    Registered User
    Join Date
    01-05-2020
    Location
    Sydney, Australia
    MS-Off Ver
    Current
    Posts
    6

    Question Calculating Values depending on Variable Suppliers

    Hi all,

    Wondering if there is an easier way to calculate cost when changing variables for supplier and time of day, where another supplier could be added without having to greatly alter the entire sum.

    Note the real world application I have now includes 2 suppliers and ten products, so the example isn't really feasible if a 3rd supplier was to be added.
    Attached Files Attached Files

  2. #2
    Valued Forum Contributor
    Join Date
    12-28-2014
    Location
    NSW, Australia
    MS-Off Ver
    MS365
    Posts
    604

    Re: Calculating Values depending on Variable Suppliers

    Hi Ricci, I've inserted a helper column as column A which can be hidden. Then used VLOOKUP to find the correct pricing row and the correct product column multiplied by the qty. This is repeated for each product so makes the formula quite long.
    More suppliers can be added very easily. If you get more then 6 then the array size for the vlookup will need to be increased in the formula.
    Adding more products would mean duplicating the VLOOKUP for that new column.

    I'm fairly sure some kind of array formula could do this in 1 step but I'm just not very good with them yet
    Attached Files Attached Files

  3. #3
    Valued Forum Contributor
    Join Date
    12-28-2014
    Location
    NSW, Australia
    MS-Off Ver
    MS365
    Posts
    604

    Re: Calculating Values depending on Variable Suppliers

    Hey again, I've been playing with array formula (just for my own experience) and almost got one working really well.
    But, alas, I still failed. But I tried another idea.
    This one uses more helper rows at the top (which should be hidden ofcourse) but basically splits my really long formula into individual cells. The benefit of this is that it will be much easier to add more products later.
    Either way, the price table (array range) should be saved as a named range. That way if you ever add more products or suppliers to the price table, all you need to do is change the area in the array name instead of editing heaps of formulas.
    Attached Files Attached Files

  4. #4
    Valued Forum Contributor
    Join Date
    12-28-2014
    Location
    NSW, Australia
    MS-Off Ver
    MS365
    Posts
    604

    Re: Calculating Values depending on Variable Suppliers

    Ok, so I've still been playing. This solution is much better I think.

    Formula in cell O2 is:
    Please Login or Register  to view this content.
    It still uses the helper column A, but you can add or subtract suppliers without it effecting the formula at all.
    To add new products, just change the N2 to the new last product column and change the 13 to the number of that column -1.
    Attached Files Attached Files

  5. #5
    Registered User
    Join Date
    01-05-2020
    Location
    Sydney, Australia
    MS-Off Ver
    Current
    Posts
    6

    Re: Calculating Values depending on Variable Suppliers

    Cheers Beamer, I had a play around with it with the irl application, but it didn't seem to adapt correctly.

    Could you possibly have a look.

    Your method is perfectly what I was looking for (Next step would have been VBA coding godforbid), I just can't seem to apply it.
    Attached Files Attached Files

  6. #6
    Valued Forum Contributor
    Join Date
    12-28-2014
    Location
    NSW, Australia
    MS-Off Ver
    MS365
    Posts
    604

    Re: Calculating Values depending on Variable Suppliers

    Ok...so...

    Formula in cell R5 was almost right. All it needed was the "Rates!" sheet reference added to the indirect function.
    =SUMPRODUCT(D5:N5,INDIRECT("Rates!"&ADDRESS(MATCH(B5&$C$2,Rates!A:A,0),4)&":"&ADDRESS(MATCH(B5&$C$2,Rates!A:A,0),14)))

    I then added an IFERROR function to prevent it from showing errors on empty lines.
    =IFERROR(SUMPRODUCT(D5:N5,INDIRECT("Rates!"&ADDRESS(MATCH(B5&$C$2,Rates!A:A,0),4)&":"&ADDRESS(MATCH(B5&$C$2,Rates!A:A,0),14))),"")

    I then replaced the $C$2 references with CELL("contents",INDIRECT(ADDRESS(ROW()-A5-2,3)))
    This uses the crew number (assuming they always stay at numbers 1-10) to target the cell containing Day/Night/Weekend. Now you can copy the formula down the page without needing to change the $C$2 to $C$18 and $C$34 etc. It does it for you.

    I also noticed that Shift Total in cell D17 can be =SUM(D16:N16) Instead of =D16+E16+F16+G16+H16+I16+J16+K16+L16+M16+N16


    Final formula for cell R5:-
    Please Login or Register  to view this content.
    Attached Files Attached Files

  7. #7
    Registered User
    Join Date
    01-05-2020
    Location
    Sydney, Australia
    MS-Off Ver
    Current
    Posts
    6

    Re: Calculating Values depending on Variable Suppliers

    Has worked perfectly. Last problem is that the products under equipement are not per hour but per a singular product. how would I work that into the sheet?

  8. #8
    Valued Forum Contributor
    Join Date
    12-28-2014
    Location
    NSW, Australia
    MS-Off Ver
    MS365
    Posts
    604

    Re: Calculating Values depending on Variable Suppliers

    I'm not sure what the difference is. Are products 1-7 meant to be multiplied by column C (Hours). How about filling in some sample numbers and manually typing your expected result into column R so we can make sure our formula returns your expected results.

  9. #9
    Registered User
    Join Date
    01-05-2020
    Location
    Sydney, Australia
    MS-Off Ver
    Current
    Posts
    6

    Re: Calculating Values depending on Variable Suppliers

    Hey Beamer thanks for the quick reply. just solved this myself when I was trying to explain my problem for you. see attached if you wanna get what I mean
    Attached Files Attached Files

  10. #10
    Valued Forum Contributor
    Join Date
    12-28-2014
    Location
    NSW, Australia
    MS-Off Ver
    MS365
    Posts
    604

    Re: Calculating Values depending on Variable Suppliers

    Excellent, that's what I was thinking but wasn't sure. Good work.

+ 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] Adding a variable range to a formula, depending on values
    By MagnaCarta in forum Excel Formulas & Functions
    Replies: 4
    Last Post: 08-07-2019, 04:59 AM
  2. [SOLVED] Variable image depending on entered values
    By Solvax in forum Excel Programming / VBA / Macros
    Replies: 4
    Last Post: 02-11-2018, 11:59 AM
  3. Replies: 3
    Last Post: 11-27-2016, 09:35 PM
  4. Replies: 1
    Last Post: 04-14-2015, 02:35 AM
  5. calculating price depending on quantity
    By impresslb in forum Excel General
    Replies: 8
    Last Post: 09-18-2011, 02:33 PM
  6. Unique values depending on variable
    By Skybeau in forum Excel General
    Replies: 2
    Last Post: 11-12-2009, 05:21 AM
  7. Calculating variable depreciation values
    By emacl in forum Excel General
    Replies: 1
    Last Post: 01-29-2008, 02:16 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