# Sum specific cells based on value in another cell.

#### ascriver

##### New Member
I would like to create a formula to automatically add the total hours per labeled time block based on the text above it. For example, I would like the formula to add the value in F26 based on the text in E24. to Does anyone know if this is possible, and if so what formula should I use? Please help!

### Excel Facts

Which came first: VisiCalc or Lotus 1-2-3?
Dan Bricklin and Bob Frankston debuted VisiCalc in 1979 as a Visible Calculator. Lotus 1-2-3 debuted in the early 1980's, from Mitch Kapor.

#### Eric W

##### MrExcel MVP
Welcome to the MrExcel forum.

For future reference, it's better to use one of the HTML tools (see my signature) to show your data. It's much easier for the helpers here to copy that onto their test spreadsheets than it is for them to actually have to retype everything. I normally wouldn't do it either, but I had some free time.

See if this works for you:

Excel 2012
BCDEFGHIJKL
25Time InTotal8:00 AMTotal7:40 AMTotal8:00 AMTotal8:00 AMTotal
26Time Out0:0010:00 AM2:009:30 AM1:501:00 PM5:0012:00 PM4:00
28Time InTotal10:00 AMTotal9:30 AMTotal2:00 PMTotal1:00 PMTotal
29Time Out0:0012:00 PM2:0012:00 PM2:303:30 PM1:303:30 PM2:30
307-L7-L7-LKAS
31Time InTotal1:00 PMTotal1:00 PMTotal3:30 PMTotal3:30 PMTotal
32Time Out0:002:00 PM1:002:00 PM1:005:00 PM1:305:00 PM1:30
34Time InTotal2:00 PMTotal2:00 PMTotalTotalTotal
35Time Out0:005:00 PM3:004:40 PM2:400:000:00
36Total
37KAS7-L
3822:109:50

<tbody>
</tbody>
Sheet8

Worksheet Formulas
CellFormula
D38=SUMIF(\$E\$24:\$K\$34,D37,\$F\$26:\$L\$36)
F38=SUMIF(\$E\$24:\$K\$34,F37,\$F\$26:\$L\$36)

<tbody>
</tbody>

<tbody>
</tbody>

Also, note that merged cells can be really bad. Formulas often don't play nice with them. Using "Center across selection" is often better.

Last edited:

1,106,318
Messages
5,510,561
Members
408,800
Latest member
Realexcel

### This Week's Hot Topics

• Turn fraction around
Hello I need to turn a fraction around, for example I have 1/3 but I need to present as 3/1
• TIme Clock record reformatting to ???
Hello All, I'd like some help formatting this (Tbl-A)(Loaded via Power Query) [ATTACH type="full" width="511px" alt="PQdata.png"]22252[/ATTACH]...
• TextBox Match
hi, I am having a few issues with my code below, what I need it to do is when they enter a value in textbox8 (QTY) either 1,2 or 3 the 3 textboxes...
• Using Large function based on Multiple Criteria
Hello, I can't seem to get a Large formula to work based on two criteria's. I can easily get a oldest value based one value, but I'm struggling...
• Can you check my code please
Hi, Im going round in circles with a Compil Error End With Without With Here is the code [CODE=rich] Private Sub...
• Combining 2 pivot tables into 1 chart
Hello everyone, My question sounds simple but I do not know the answer. I have 2 pivot tables and 2 charts that go with this. However I want to...