+ Reply to Thread
Results 1 to 6 of 6

Sum of (If match in one column then take value in another column same row) - Stumped!

  1. #1
    Registered User
    Join Date
    07-05-2006
    Posts
    8

    Sum of (If match in one column then take value in another column same row) - Stumped!

    Hi there,

    Stumped myself taking on a little piece of work for a friend after showing off some basic VBA user form skills a few months ago.

    Situation

    Sheet 1
    Column C contains a drop down box for course selection
    Coloumn K contains a user inputed value for amount paid so far


    Sheet 2
    Column B contains a list of courses

    I would like column C in sheet 2 to have something like the following:


    If the entry in column c sheet 1 matches an entry in column b sheet 2 then add the value in column k sheet 1 to column B sheet 2

    Of course the situation will exist where there are several rows of data in sheet 1 which are for the same course so the answer needs to be a sum function rather than a retrieve value.

    I have confused myself to the point where I have no idea what to do now or even if im looking at a formula in sheet or having to resort to VBA!

    Any pointers in the right direction will be a greatly appreciated.

  2. #2
    Forum Expert sweep's Avatar
    Join Date
    04-03-2007
    Location
    Great Sankey, Warrington, UK
    MS-Off Ver
    2003 / 2007 / 2010 / 2016 / 365
    Posts
    3,454
    Hi,

    Have you got an example you can post?

    Dave

  3. #3
    Registered User
    Join Date
    07-05-2006
    Posts
    8
    Ill try and post what i can

    Sheet 1
    Please Login or Register  to view this content.
    Where Course type is a drop down box in Coloumn C and Amount paid is entered in coloumn K

    Sheet 2
    Please Login or Register  to view this content.
    Where Course code is coloumn C and Total is Coloumn D


    What i would like is for the total box to show the amount paid of all the courses of that type, ie in the above example the total for DTS would be 1221 and for DSS 777.

    I have got this far to look up the first value, but unsure how to add all matching values.

    Please Login or Register  to view this content.
    (PS is thre is an easier way to post an example let me know!)

    Thanks

  4. #4
    Registered User
    Join Date
    07-05-2006
    Posts
    8
    Ohhh i think i may have it,


    Please Login or Register  to view this content.

  5. #5
    Forum Expert sweep's Avatar
    Join Date
    04-03-2007
    Location
    Great Sankey, Warrington, UK
    MS-Off Ver
    2003 / 2007 / 2010 / 2016 / 365
    Posts
    3,454
    You got it while I was typing!!!!

    OK,

    Take a look at the sumif function.

    In your example, you can do this:

    =sumif(sheet1!B:B,"=DTS",sheet1!K:K)

    or even

    =sumif(sheet1!B:B,sheet2_cell_that_contains_DTS,sheet1!K:K)
    Rule 1: Never merge cells
    Rule 2: See rule 1

    "Tomorrow I'm going to be famous. All I need is a tennis racket and a hat".

  6. #6
    Registered User
    Join Date
    07-05-2006
    Posts
    8
    thanks for the help (you always get the answer after you ask for help!), got too caught up in lookup and never used the +sumif before!

+ 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