Results 1 to 11 of 11

Thread: [RESOLVED] Adding cells based on adjacent cell text

  1. #1

    Thread Starter
    New Member
    Join Date
    Jul 2014
    Posts
    6

    Resolved [RESOLVED] Adding cells based on adjacent cell text

    I am looking for a function / custom function to automatically sum values from a column of cells based on the value of the cell next to it. I attached a copy of my spreadsheet. What I am trying to do is at the bottom of the spreadsheet is a tally of the total hours I spent through the week on each job. I want this to generate the total hours automatically. The job number cells change week to week and will be typed in manually.

    So based on my example sheet attached, In Cell C57 I want to know the total number of hours I worked on the job shown in Cell B57. So the function should search for the job number in Column C, and add the total in column M wherever that job was recorded.
    I was only able to attach a screenshot for some reason.

    Thank you.

    Name:  example.jpg
Views: 172
Size:  37.4 KB

  2. #2
    PowerPoster
    Join Date
    Oct 2008
    Location
    Midwest Region, United States
    Posts
    3,574

    Re: Adding cells based on adjacent cell text

    Zip to attach the workbook

  3. #3

    Thread Starter
    New Member
    Join Date
    Jul 2014
    Posts
    6

    Re: Adding cells based on adjacent cell text

    Thanks for the tip. My example file is now attached.
    Attached Files Attached Files

  4. #4
    PowerPoster
    Join Date
    Oct 2008
    Location
    Midwest Region, United States
    Posts
    3,574

    Re: Adding cells based on adjacent cell text

    You can use the "sumif" function if you change your data slightly. If you put only the JOB# in cells b56 and b57, for example, you could use this formula in c56 (then copy to c57):

    Code:
    =SUMIF(C$4:C$10,B57,M$4:M$10)

  5. #5

    Thread Starter
    New Member
    Join Date
    Jul 2014
    Posts
    6

    Re: Adding cells based on adjacent cell text

    I thought about that originally but That is how accounting wants it formatted which is what brought me to asking for help here.

  6. #6
    PowerPoster
    Join Date
    Oct 2008
    Location
    Midwest Region, United States
    Posts
    3,574

    Re: Adding cells based on adjacent cell text

    ok, then maybe we can concatenate in the criteria of the sumif function instead. back with more on that shortly.

  7. #7
    PowerPoster
    Join Date
    Oct 2008
    Location
    Midwest Region, United States
    Posts
    3,574

    Re: Adding cells based on adjacent cell text

    Even that's going to be hard to do, unless you can ensure that the "syntax" in column D is the same as what's in column B. For example, if we concatenate C4 and D4 to get "36 In house" but in b57 we have "36 In-House" we won't get a match. Thoughts?

  8. #8

    Thread Starter
    New Member
    Join Date
    Jul 2014
    Posts
    6

    Re: Adding cells based on adjacent cell text

    The syntax may not be important if I just search based on the Job number. So the 36 becomes all that is important since up above the number and text are in separate columns.

  9. #9
    PowerPoster
    Join Date
    Oct 2008
    Location
    Midwest Region, United States
    Posts
    3,574

    Re: Adding cells based on adjacent cell text

    So you want to split the contents of cell b57, for example, so you only get the "36" part of it? Is it always going to be in the format Job# (space) Client?

  10. #10

    Thread Starter
    New Member
    Join Date
    Jul 2014
    Posts
    6

    Re: Adding cells based on adjacent cell text

    yes it will

  11. #11

    Thread Starter
    New Member
    Join Date
    Jul 2014
    Posts
    6

    Re: Adding cells based on adjacent cell text

    I figured out a solution. For a future reference if anyone has a similar issue, this is the formula I used.

    Code:
    =SUMIF($C$4:$M$54,LEFT(B57,FIND(" ",B57)-1),$M$4:$M$54)

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  



Click Here to Expand Forum to Full Width