So here is my scenario, I already have a sub that extracts unique names and unique dates from Sheet 1 into Sheet 2 creating the layout of unique names as rows and dates as headers. In Sheet 1 is the master data. For each day of the month, there are different work shifts for the same person. For example...
D Gray worked 3 different shifts on 6/26 so i need the values in Hours summed and then populated into Sheet 2 under the respective 6/26 date and so on and so forth for the other crew members. The template so far is..
Result of New Code
I can't see the image, but I understand your concept so hopefully you can apply the below to your case and use this as your answer.
Say the data in Sheet1 is columned as Date, Name, & Hours worked for A,B, & C respectively (for only 100 rows), your SUMIFS function in sheet2 should be as follows:
=SUMIFS(Sheet1!$C$1:$C$100,Sheet1!$A$1:$A$100,B$2,Sheet1!$B$1:$B$100,$A2)
This as you drag it down will hold the first column in sheet2, the names, and the first row in sheet2 the dates, summing up all the hours worked for all the days of the month.
If you use table formatting you can simply this further and the formula will resize with the table since it would use named ranges. I can help you with that as well if you'd like.
To have VBA add this formula to your spreadsheet use the following:
Dim RangeFormula As Range
Set RangeFormula = Sheet("Sheet2").Range( [input cell range here])
RangeFormula.Formula ="=SUMIFS(Sheet1!$C$1:$C$100,Sheet1!$A$1:$A$100,B$2,Sheet1!$B$1:$B$100,$A2)
You can change the name from RangeFormula to whatever suits better, you can put the sheet name where Sheet2 is but make sure you put the cell range in the range part with " surrounding it. To reference this as a table you'll need to use the ListObjects("Table Name")
Related
I have a sheet (1) where header cells of columns hold week numbers and dates of mondays per every week.
Then i have another sheet (2) of reservations. I would need to create reservation view to sheet 1 where each cell of each resource row checks from sheet 2 if any day in current week hits any reservation from sheet 2 and return a number for that cell (for formatting purposes, number 1 in example below). There are multiple rows in sheet 2 for each unique resource, so i could not use VLOOKUP, since it returns only first occurrence.
Those numbers 1,2,3,4... in sheet 1 are ISO week numbers 1-53.
Sheet 1:
Sheet 2:
I've tried to approach this with IF/AND/VLOOKUP, but with no success...
=IF(AND(D$7>=VLOOKUP(B9;gantt_data!$A$3:$E$52;4;FALSE);D$7<=VLOOKUP(B9;gantt_data!$A$3:$E$52;5;FALSE);;);1;)
Thank you for help already!
You can try SUMPRODUCT function:
=IFERROR(1/SUMPRODUCT(($B4=$A$16:$A$24)*((DATEVALUE(C$2 & C$1)+7)>=$C$16:$C$24)*(DATEVALUE(C$2 & C$1)<$D$16:$D$24));"")
I believe a simple COUNIFS will do the job. Please try this formula. Paste it into your cell B9 of your table on Sheet1 and copy it from there to the right and down as required.
=COUNTIFS(Table1[Task Name],$A10,Table1[Reservation start],"<=" & B$7,Table1[Reservation end],">" & B$7+7)
Note that I presumed your Sheet2 to hold Table1. Please replace the range with another name if a range Table1 doesn't comprise of the DataBodyRange of your table on Sheet2. To avoid seeing all the zeroes please format the cells with the formula as Custom 0;;
So I have this huge report and I'm looking to analyze it better. I have Data in one work book (1)and I'm creating a separate workbook (2) to reflect certain criteria.
Workbook 1-I have Data in Col A, Col B, Col C.
Column A has abbreviated businesses (ex. Abc, Def, Ghi)
Column B has Dates for everyday of last year and this year (ex.1/3/2017)
Column C has Y or N values.
Workbook 2- In work book 2, I need data from the previous month, of a particular business (Abc) with just values equal to Y
You should make a pivot table that contains the data you want, and then double click the cell containing the data meeting your criteria and it will pull up the source data for only those criteria. That's a pretty simple way to do it.
i.e. Make a pivot table in Workbook 1 with a month filter, a business filter, and a values equal to Y filter.
EDIT:
I took a stab at it without getting your specifics. Images including formula are attached.
Sheet1 contains the data. Sheet2 calculates the sum for the month for each business.
These are array formulas and require you use ctr+shift+enter to confirm the cell. Then you can drag down for month and business as needed.
{=SUM(IF(Sheet1!$A$2:$A$43=A2,IF(Sheet1!$B$2:$B$43>=D2,IF(Sheet1!$B$2:$B$43<=E2,Sheet1!$C$2:$C$43))))}
NOTE: My sheet1 only went down to row 43, hence the $43 in the equation. You'll need to replace those values with your values.
This also assumes that you are using dates down to the day. If you have a column that is for Months, and it's text, then you can nest an IF($B$2:$B$43="January", .... or however you have your months defined.
So I inherited an Excel file that is used to schedule and track PTO and OT time for about 100 employees. They have a column for every day of the year and have the year split over two sheets.
I am trying to create a totaling sheet that shows a grouping for each employee and counts up each of the types of time codes that are used in the tracking sheets. Each time type has a code that is used for condidtional formating NM1, NM2,...
I am trying to create a formula that will check the employee's name against the name column on the tracking sheet and then count just part of the row for cells that contain NM1, etc
Here is one of the cells as it is now:
=COUNTIF('2015MarNov'!$E$88:$AH$88,"*"&"NM1"&"*")
the employee name is in column D and this is counting NM1 for just January (columns E through AH).
Use this:
=COUNTIF(INDEX('2015MarNov'$E:$E,MATCH("NAME",'2015MarNov'$D:$D,0)):INDEX('2015MarNov'$AH:$AH,MATCH("NAME",'2015MarNov'$D:$D,0)),"*"&"NM1"&"*")
Change the "NAME" to the cell on the summary sheet the has the Employee name. You could also change the "NM1" to a cell reference.
Try this:
=COUNTIF(OFFSET($E$1:$AH$1,MATCH(<target employee cell>,$D:$D,0)-1,0),"*NM1*")
In this example I assumed that row 1 contains the header and that row 2 starts with the employees. If that is not the case try something like this:
=COUNTIF(OFFSET($E$5:$AH$5,MATCH(<target employee cell>,$D$6:$D$106,0),0),"*NM1*")
Edit, explanation:
Match(<target employee cell>,<range of employees>,0)
This function returns the relative row in which the target employee is found, i.e. if the employee is in D7 and the range is D6:D106 then the returned value is 1, since this the relative offset from the starting range (starting at 0)
OFFSET(<range>,<rows>,<columns>)
This function shifts any given range by the number of rows and columns as specified. In the previous function the range is offset by 1 row (shifted 1 row down).
COUNTIF(<range>,<criteria>)
The <range> is determined by the shifted range from the OFFSET function.
As the title suggests, I have a worksheet (sheet1) that has lots of data that spans columns A-E and with rows that are added daily, What I want to do is on a separate worksheet (sheet2) show the data from the last 5 rows of sheet1.
Providing there is continuous data within column A on Sheet1, you could also use the INDIRECT() and COUNTA() functions.
=INDIRECT("Sheet1!$A$"&COUNTA(Sheet1!$A:$A)-4)
=INDIRECT("Sheet1!$A$"&COUNTA(Sheet1!$A:$A)-3)
=INDIRECT("Sheet1!$A$"&COUNTA(Sheet1!$A:$A)-2)
=INDIRECT("Sheet1!$A$"&COUNTA(Sheet1!$A:$A)-1)
=INDIRECT("Sheet1!$A$"&COUNTA(Sheet1!$A:$A))
You would need to amend the column letter within the INDIRECT function for each column of data which you wish to view on Sheet2.
In an appropriate cell on Sheet2, use this formula,
=INDEX(Sheet1!A:A, MATCH(1E+99, Sheet1!$A:$A)-(ROW(1:1)-1))
Fill right for a total of 5 columns then fill those 5 cells down 5 rows.
That formula will find the last number in a column. This is often the case as the left-most column mat hold an ID number. The same reference point should be used to collect cell values from other columns to avoid the confusion that a rogue blank cell would create.
If all you have are text values then the formula in the first cell would be,
=INDEX(Sheet1!A:A, MATCH("žžž", Sheet1!$A:$A)-(ROW(1:1)-1))
Fill right and down as described above.
I have a workbook with 7 sheets containing part number of a product in column and its cost in adjacent column. And the 7th sheet contains total number of parts in all the sheets. I want to change cost of some products but then I have to do the same in all sheets. Is there a way by which it automatically finds and changes cost in individual sheets when i change it in the sheet containing total?
Use VLOOKUP on the first 6 sheets to match the price to each part number.
So, in each "cost" column on the first 6 sheets, enter this formula (assuming Cost on Sheet7 is still in column C):
=IFERROR(IF($A1="","",VLOOKUP($A1,Sheet7!$A:$C,3,FALSE)),"")
If you have header row(s) then just replace the two instances of $A1 in the formula with whatever the first row of data is (e.g. $A2), paste the formula into that row in column C on Sheet1, then drag-copy the formula down as far as you want. Repeat for sheets 2-6.