Excel... Sum a row of values based on a character in the value - excel-formula

I have 31 columns representing each day of the month. I have 2 housekeepers cleaning rooms. The rows represent the villa numbers from 1 to 18.
Housekeeper #1's name starts with "A" and housekeeper #2's name starts with "L"
I need to total the number of cleaning hours for housekeeper #1 in column AG and housekeeper #2 in column AH. The hours spent cleaning is a digit on the right side of the name.
The cells go across a row from B5:AF5 and look like this
Ann4__Ann3__Ann7__Lisa2__Lisa4__Ann4__Lisa1
For the "Ann" hours totals in AG5 I have tried using SUMIFS with this formula
=SUMIFS(right(B5:AF5),left(B5:AF5),"A") but Excel returns an error.
I also tried SUMIF for the number of hours for Ann
=SUMIF(LEFT(B5:AF5),"A","(RIGHT(B5:AF5)*1)) Excel still says error.
The hours digit after each name is text, so I tried multiplying the result by 1 to convert to numeric.

For Ann:=SUM(IF(LEFT(A1:D1,3)="ANN",RIGHT(A1:D1,1)*1,"")). For Lisa:=SUM(IF(LEFT(A1:D1,4)="Lisa",RIGHT(A1:D1,1)*1,"")). Both are Array entered with Ctrl+Shift+Enter

Related

Excel - counting how many consecutive 0s in a row

I have multiple ‘people’ in rows in excel, with 10+ columns of system usage data. I want the final column to show how many consecutive months have 0 usage. For example, person a might have had 0 usage in March and April, used in June, then 0 usage in July - December, I would need the end column to show 6.
If your data is from B2 to M2 you could use the following formula:
=MAX(FREQUENCY(IF(B2:M2=0,COLUMN(B2:M2)),IF(B2:M2<>0,COLUMN(B2:M2))))
This will show the max number of consecutive 0's in that row 2 from column B to M.
Older versions of Excel require this array formula entered with ctrl+shift+enter
If you want the formula to show the quantity of consecutive zeroes of the last occurance in the row then you could use:
=LOOKUP(2,1/(FREQUENCY(IF($B2:$M2=0,COLUMN($B2:$M2)),IF($B2:$M2<>0,COLUMN($B2:$M2)))>0),FREQUENCY(IF($B2:$M2=0,COLUMN($B2:$M2)),IF($B2:$M2<>0,COLUMN($B2:$M2))))
I've made something for you, based on the numbers of the months in the year: 1-12 (in column "item").
In the "Value" column, there are the values zero or else.
The "Length" column contains the number of subsequent zeroes, based on following formulas:
First entry : =IF(B2=0,1,0)
Following entries: =IF(B3=0,C2+1,0)
Screenshot:
Have fun!
This might help if 2 is threshold for consecutive in F3:AI3
=SUM((FREQUENCY(IF(F3:AI3>=0,COLUMN(F3:AI3)),IF(F3:AI3<0,COLUMN(F3:AI3)))>=2)*1)
suppose I want count of values more than 10 in groups of 5 and more then
=SUM((FREQUENCY(IF(F3:AI3>=10,COLUMN(F3:AI3)),IF(F3:AI3<10,COLUMN(F3:AI3)))>=5)*1)
hope this helps

Excel column autofill (autoincrement with formula)

500 employees will have 3 hours of work each day (for sample made weekday image sample). so i tried with auto increment for B2 cell "=sum(A2+3)".
problem arise when i try to enter Absent data or the cell is cleared the data starts from 3 like in E4 or like in E5. need to Enter AA for absent data for that day.
So base the calculation on col A only and multiply the 3 by the column number less 1:
=$A2+(3*(col()-1))
as the column position will multiply by 1, 2 or 3 etc similar to the progression you expected from your method.

Excel code to sum the last 7 cells in a row but if one of the values is 0 reset and start adding cell rows to the right as entered

I'm using Excel Office 365. Col A = Total hours Col B Name Col C-Y head.Date/Day entered hours worked. I am trying to sum the latest seven days hours entered and totaled in column A. I have completed this step. The difficulty I'm having is that if the hours entered in columns C-Y is equal to zero I need to reset the Total Hours and start adding the hours on the next cell.
=SUM(OFFSET(B4,0,COUNTA(C$4:CC$4),1,-7))
sum the hours from the most recent entries.
You are not showing the full range so I am assuming that you are looking for the last 7 cells in the not blank area. Try this one:
=IF(SUM(OFFSET(B4,0,COUNTA(C$4:CC$4),1,-7))=0, 0,SUM(OFFSET(B4,0,COUNTA(C$4:CC$4),1,-7)))
Hope it helps

sum assigned vlaues if sum for each value meets a specific criterion

in excel, I have two columns. one containing months of the year (in numbers) each month number occurring in different number of rows, and in the second column I have a duration of time for each row (in hours and minutes).
now I want to do the following job with an excel function in just one cell (the same job could be done using a table with 12 cells, each for one month but I want to pack it all in one cell):
1- for each month number, sum all cells in the second column (time) which have that month number in the adjacent cell (this could be done with a sumif )
2- if that sum is more than 4 hours then return one for that month else return zero (this step could be done with a formula like this: IF(R10>(--"4:00");1;"") )
3. in the end the numbers assigned to each month summed together.
thanks to everyone who helps
the picture below, shows the steps:
enter image description here
Try,
=SUM(--(SUMIFS(Table1[time],Table1[month],{1,2,3,4,5,6,7,8,9,10,11,12})>TIME(4,0,0)))

Excel lookup vector based on another formula

My spreadsheet has 2 sheets.
Sheet 1 contains 30 days worth of values.
Each day's values are a maximum of 19 rows, consisting of names and correspoding values. The names that will appear for each day are not the same every day. In other words my name might appear on the 1st, 2nd and 14th of the month and not on any other days. (And these values may not be sorted.)
My second sheet will display only one persons values for the month, and I therefore use a lookup.
The formula for the 1st day is:
=LOOKUP("name";'Input Sheet'!$A$2:$A$20; 'Input Sheet'!B2:B20)
For the second day it would be:
=LOOKUP("name";'Input Sheet'!$A$22:$A$40; 'Input Sheet'!B22:B40)
The only thing that changes for each day is the lookup range/vector. I have a separate (hidden) column already that has calculated the correct starting row number, i.e. 22, 42, 62, but how would I use that number to change the lookup range on my formula?
Thanks a lot
Michael
The indirect() function will allow you to specify the range for your lookup in terms of another cell.
For example, if Sheet1 of the workbook has the numbers 1-10 going from A3:A12, where the starting row (3) is specified in cell B1 of the same worksheet.
3
1
2
3
4
5
6
7
8
9
10
Then to lookup the value 5 and place the answer on any other sheet of the workbook:
=LOOKUP(5,INDIRECT("Sheet1!$A"&Sheet1!$B$1&":$A$12"))

Resources