Sum specific cells based on value in another cell.

ascriver

New Member
Joined
Aug 16, 2019
Messages
1
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!


 

Some videos you may like

Excel Facts

Format cells as date
Select range and press Ctrl+Shift+3 to format cells as date. (Shift 3 is the # sign which sort of looks like a small calendar).

Eric W

MrExcel MVP
Joined
Aug 18, 2015
Messages
9,922
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
247-L7-LKASKAS
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
27KASKASKAS7-L
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
33KASKAS
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:

Watch MrExcel Video

Forum statistics

Threads
1,102,840
Messages
5,489,191
Members
407,675
Latest member
meaghutter

This Week's Hot Topics

  • Timer in VBA - Stop, Start, Pause and Reset
    [CODE=vba][/CODE] Option Explicit Dim CmdStop As Boolean Dim Paused As Boolean Dim Start Dim TimerValue As Date Dim pausedTime As Date Sub...
  • how to updates multiple rows in muliselect listbox
    Hello everyone. I need help with below code. code is only chaning 1st row in mulitiselect list box. i know issue with code...
  • Delete Row from Table
    I am trying to delete a row from a table using VBA using a named range to find what I need to delete. My Range is finding the right cell. In the...
  • Assigning to a variable
    I have a for each block where I want to assign the value in column 5 of the found row to the variable Serv. [CODE=vba] For Each ws In...
  • Way to verify information
    Hi All, I don't know what to call this formula, and therefore can't search. I have a spreadsheet with information I want to reference...
  • Active Cell Address – Inactive Sheet
    How to use VBA to get the cell address of the active cell in an inactive worksheet and then place that cell address in a location on the current...
Top