Add cells with text and numbers in same cells based on the text in the same cell

steve1979

New Member
Joined
Nov 4, 2020
Messages
14
Office Version
  1. 365
Platform
  1. Windows
I have been trying to find a way to add the values in cells, but the cells contain text as well as numbers. The sheet is to calculate overtime. i can get it to count the cells with the text in it and from there i multiply by 12 to get the hours worked, but i need to add number to the same cell in the case that person does not work 12 hours see example:
17 oct to 16 november overtime.xlsm
ABCDEF
1Date17-Dec18-Dec19-Dec20-Dec21-Dec
2DayThuFriSatSunMon
3Day Shift
4O/T Person
5O/T Personperson A 12
6O/T Person
7Night Shift
8O/T Person
9O/T Person
10O/T Person
11
12Date22-Dec23-Dec24-Dec25-Dec26-Dec
13DayTueWedThuFriSat
14Day Shift
15O/T Personperson A 8
16O/T Person
17O/T Person
18Night Shift
19O/T Person
20O/T Person
21O/T Person
22NameCtrl No:DaysHours
23person A224
test sheet
Cell Formulas
RangeFormula
C12:F12,C1:F1C1=B1+1
B13:F13,B2:F2B2=TEXT(B1,"ddd")
B12B12=F1+1
E23E23=SUM(COUNTIF($B$3:$F$6,"*"&C23&"*"),COUNTIF($B$8:$F$10,"*"&C23&"*"),COUNTIF($B$15:$F$17,"*"&C23&"*"),COUNTIF($B$19:$F$21,"*"&C23&"*"))
F23F23=E23*12

Person A worked 2 days ( one he worked for 12 hours and next 8 hours the total should be 10 but my calculation gives me 24. ( 2 days *12)
i need it to add the hours worked based on the persons name and hours inserted. if no hours inserted it should default to 12.
a formula i tried does not work, it reads false and reverts to days worked *12.
the formula ( was on different sheet) the ranges are 4 different ranges
=SUM(IF(ISNUMBER(FIND(C33;SearchRng));VALUE(LEFT(SearchRng;FIND(C33;SearchRng)-1));E33*12))
 

Excel Facts

Add Bullets to Range
Select range. Press Ctrl+1. On Number tab, choose Custom. Type Alt+7 then space then @ sign (using 7 on numeric keypad)
What you are trying to do could be done with a massively convoluted formula that would be almost impossible to debug. I suggest you have two columns for each date. Left column is the person's name, right column is the hours. Then F23 would contain 5 SUMIFS functions (one for each pair of columns) along the lines of =SUMIFS(C3:C22,B3:B22,F23) + SUMIFS(... This assumes that you have inserted the additional columns and what is in your example as column C would then be column D. I prefer to use SUMIFS even though there is only one criteria because it puts the sum range first instead of last like SUMIF which means if you want to add a second criteria later you just add it at the end instead of have to re-jig the whole thing changing from SUMIF to SUMIFS.
 
Upvote 0

Forum statistics

Threads
1,224,823
Messages
6,181,182
Members
453,020
Latest member
Mohamed Magdi Tawfiq Emam

We've detected that you are using an adblocker.

We have a great community of people providing Excel help here, but the hosting costs are enormous. You can help keep this site running by allowing ads on MrExcel.com.
Allow Ads at MrExcel

Which adblocker are you using?

Disable AdBlock

Follow these easy steps to disable AdBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the icon in the browser’s toolbar.
2)Click on the "Pause on this site" option.
Go back

Disable AdBlock Plus

Follow these easy steps to disable AdBlock Plus

1)Click on the icon in the browser’s toolbar.
2)Click on the toggle to disable it for "mrexcel.com".
Go back

Disable uBlock Origin

Follow these easy steps to disable uBlock Origin

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back

Disable uBlock

Follow these easy steps to disable uBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back
Back
Top