+ Reply to Thread
Results 1 to 8 of 8

New SUM challenge

  1. #1
    Registered User
    Join Date
    03-22-2008
    Posts
    5

    New SUM challenge

    Hi again,

    I have a new challenge. Please check out the attached spreadsheet.

    The blue coloured figures are fields I will be updating on a daily basis.

    First Question:
    For cell D4 I need a formula to get the total of (E4*F4)+(G4*H4)+(I4*J4)+ etc etc to the end of the row, obviously without having to do it manually if possible

    Second Question:
    For cell C4 I need a formula to get the total of E4+G4+I4+K4+ (ie. skipping a column), again to the end of the row.

    I hope I explained myself well enough, thanks in advance any who attempt to help!

    Martyn
    Attached Images Attached Images

  2. #2
    Valued Forum Contributor
    Join Date
    08-31-2007
    Location
    SW Ireland
    MS-Off Ver
    Microsoft Excel for Microsoft 365 MSO (Version 2311 Build 16.0.17029.20068) 32-bit
    Posts
    523
    This is an ugly hack for cell D4 that will work for the first part of your problem but only if you have 1 spare column available at the very end of your data (ie you're not already using all of the cells to the very last column in Excel):

    Please Login or Register  to view this content.
    In the above formula, you would replace the reference to L4 and M4 with the actual last cell of data and 'spare cell' respectively. Note also that you use F4 instead of E4 as indicated by the green text in the above code.

    The following should address your second problem:

    Please Login or Register  to view this content.
    Again, replace references to g4 with the last cell of your actual data.
    Last edited by deadlyduck; 03-22-2008 at 02:46 PM.

  3. #3
    Forum Expert mrice's Avatar
    Join Date
    06-22-2004
    Location
    Surrey, England
    MS-Off Ver
    Excel 2013
    Posts
    4,967
    For the first question, use the following user defined function where MyRange is the range of counts and prices.

    Please Login or Register  to view this content.
    The second can be answered by a similar function

    Please Login or Register  to view this content.
    Martin

  4. #4
    Forum Expert daddylonglegs's Avatar
    Join Date
    01-14-2006
    Location
    England
    MS-Off Ver
    2016
    Posts
    14,675
    Quote Originally Posted by martynonline
    For cell D4 I need a formula to get the total of (E4*F4)+(G4*H4)+(I4*J4)+ etc etc to the end of the row....
    Try this

    =SUMPRODUCT(E4:IU4,F4:IV4,MOD(COLUMN(E4:IU4),2))

  5. #5
    Registered User
    Join Date
    03-22-2008
    Posts
    5
    hi all,

    just wanted to come back to say thanks for the answers everyone gave!


    in the end i used the first answer i received (happened to be from another board) and they seem to be working well so far. but thanks again for the extra solutions and taking the time to help . i put it below if anyones interested

    Please Login or Register  to view this content.

  6. #6
    Forum Expert daddylonglegs's Avatar
    Join Date
    01-14-2006
    Location
    England
    MS-Off Ver
    2016
    Posts
    14,675
    I don't really see the advantage of the unnecessary complexity of the first when you can modify the second formula by adding a single range to get exactly the same result , i.e.

    =SUMPRODUCT(--(MOD(COLUMN(E4:IS4)-COLUMN(E4)+1,2)=1),E4:IS4,F4:IT4)

    Note: perhaps it's not an issue but that formula will treat any blanks within the range as a zero, the one you're using will treat them as 1s

  7. #7
    Registered User
    Join Date
    03-22-2008
    Posts
    5
    yeah that was an issue i noticed, i had to go about filling the blanks, it wasn't the perfect solution thats for sure (maybe why it was my first reply )

    i've given your revised code a shot and it seems to do a nicer job of it as i prefer to leave all the cells blank until i need to fill them so it makes it easier to spot errors so thank you again daddylonglegs! much obliged!

  8. #8
    Forum Expert NBVC's Avatar
    Join Date
    12-06-2006
    Location
    Mississauga, CANADA
    MS-Off Ver
    2003:2010
    Posts
    34,898
    Quote Originally Posted by martynonline
    ...
    in the end i used the first answer i received (happened to be from another board) and they seem to be working well so far. but thanks again for the extra solutions and taking the time to help . i put it below if anyones interested
    ...
    Please read this link on crossposting:

    http://www.cs.tut.fi/~jkorpela/usenet/xpost.html

    and

    http://www.excelguru.ca/node/7
    Where there is a will there are many ways.

    If you are happy with the results, please add to the contributor's reputation by clicking the reputation icon (star icon) below left corner

    Please also mark the thread as Solved once it is solved. Check the FAQ's to see how.

+ Reply to Thread

Thread Information

Users Browsing this Thread

There are currently 1 users browsing this thread. (0 members and 1 guests)

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