Excel Formulas for two workbooks-multiple criterias - excel

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.

Related

How can I search a table column for a specific month, and then have excel output a list of names from a different column that match that month?

This is probably a very simple formula.
I have an employee database that looks like this:
I want to make a list of everyone who was hired in January (for example) in another workbook.
So I need to scan column 7 (Employees[Hired on]) of the table, and have excel output the employee's name from column 2 (Employees[First Name]) to the other workbook.
I'm assuming I can use variations of this same formula to gather my other data.
You need an intermidate column, because Excel can't filter by "modified value" (as far as I knew).
So, my solution is:
insert column between column E and F. The old columns after column F will be shift right by 1 column (F -> G, G -> H, and so on).
input F8 with =MONTH(E8).
Copy F8's formula to below (I assume it is F26).
input with =COUNTIFS(Work!F8:F26, 1). Note that Work in the range should be replaced with your work sheet name.
Step 1 to 3 may be done on another sheet. You should qualify sheet name like step 4.

Summing values into new sheet for unique dates and unique names

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")

Multiple criteria to sum a range of data

I'm using Excel 2013:
I calculated when income/expense would fall on a given date in the year: Budget sheet on top, Event Calc sheet on bottom
On my "Budget Adjust" sheet, I then wanted to sum the amounts with the criteria of: 1) within two dates and 2) matching the income/expense type:
While I now understand that I can't use SUMIFS (because my data to sum and date criteria are different sizes), I'm wondering if any of you have a brilliant idea about how to sum the data for specific date ranges and a type match.
ADDITIONAL INFO: Using the data in the first few columns, I created a dynamic formula for each day in the year, so columns T:NV, with a day of the year in Row 1:
=IF($D2<>0,IF(AND(U$1>=$C2,(U$1-$C2)/$D2=ROUND(((U$1-$C2)/$D2),0)),$B2,0),IF(DAY(U$1)=$E2,$B2,0)).
For that day of the year, for the type of income/expense, it would enter either the income/expense that would fall on that day, or zero. There are 365 such columns (T:NV), one for each year.
My attempt was to use the range of data (T2:NV20) in one formula on the Budget Adjust sheet that would search for: 1) within a given date rage, and 2) for each Type, then return the Sum of the amounts found within that date range
--- EDIT ---
I want an elegant answer, with one formula in the results field, but here's how I've made it work:
I'm limited to two pics per post, so here is a pic of both sheets:
My work-around to get the answer
On top is is the Event Calc page, where I've created a column for each month, and H2 is highlighted with the formula above:
=SUMIFS($U2:$NV2,$U$1:$NV$1,">="&H$1,$U$1:$NV$1,"<"&I$1)
On the bottom is the Budget sheet with D9 (Salary for Jan-2016) highlighted:
using this formula:
=SUMIFS('Event Calc'!H$2:H$20,'Event Calc'!$A$2:$A$20,"="&$B9)
Why wouldn't you just use 'Event Calc' columns A, B and C? That is already in a proper format for a SUMIFS formula. On sheet "Budget Adjust" cell D17, use this formula:
=SUMIFS('Event Calc'!$B:$B,'Event Calc'!$A:$A,$B17,'Event Calc'!$C:$C,">="&D$10,'Event Calc'!$C:$C,"<="&D$11)
and then copy right and down

need the cound of Row C if the condition of Row A and B is match

IN row A i am having Date (Date might be today's date, yesterday’s date and day before yesterday's date)
In Row B i am having person name (Name Can be Arindam , Samir,Amit,Din
In Row C I am having the work status (Ctatus Can be Closed,Work in progress,Waiting,New
Now I want the Close Count status of Row C in Row D, but condition should be” if Row A is today's date and Row C is Arindam.”
Is it possible by excel formula?
Please help me out
This works for me, but there are a LOT better ways to organize your data (like with Tables and named Columns) that will make this kind of thing easier.
=IF(AND(A1=TODAY(), B1="Arindam"), C1, "")
You can "fill" that formula down the whole column D and the row number will auto-adjust. You might need to edit the A1/B1/C1 to match the row you actually paste this into (probably row 2 or greater, if you have a header row).
Op asked a follow-up that couldn't be easily answered in a comment.
From Excel help:
The COUNTIF function counts the number of cells within a range that
meet a single criterion that you specify.
COUNTIFS is a more complex variation of that.
For the original example given, the simple IF() above works correctly. COUNTIF is meant to count the NUMBER of cells (not to sum them) that meet certain criteria (like Date>Today, Count>3, or anything). There is a SUMIF that will sum up cells, but you didn't say you want to sum up cells, you said wanted the "Close Count status of Row C in Row D".
If instead you want a cell (not necessarily in column D, associated with the data in a single row) that "sums" up all of a given Close Count on a page, you could do this:
=SUMIFS(C:C,A:A,"="& TODAY(),B:B,"Arindam")
That's really great for a summary of ALL the rows of data, but it sounded like you wanted a summary per row, for which you should use the simpler IF() given above.
OK, one more update, now that I'm understand the original data better. This can be done in EACH row, and if you really want a total for the entire set of data, you'll have to have a total row (or separate sheet) that adds up column D:
=IF(AND(A1=TODAY(), B1="Arindam", C1="Closed"), 1, "")
This puts a "1" in column D if the criteria in columns A, B, and C match what you want.
If you want a single cell that sums up all the matches, then Jerry gave the correct answer (this is from him, and I think it's the best answer, although it was in the comments):
=COUNTIFS(A1:A10,TODAY(),B1:B10,"Arindam",C1:C10,"New")

Matching Column Data from 2 mismatched worksheets, then automatically line the data up, adding blank rows when necessary

I have an estimating program for the construction industry that will convert it's reports to excel.
I would like to compare the product type from the original estimate in Column A and compare it to the product type in Column A of a revised estimate in a seperate worksheet. The columns for the two worksheets won't necessarily have the same number of rows. Some products in worksheet 1 won't be in worksheet 2, and vice versa.
I would like to compare the two and add rows where necessary so that I can use a simple subtraction equation to determine how much material to add or subtract.
For example:
Column A in worksheet 1 has the folling 4 entries starting in row 1 (M, M2, MF2, and MPNL). Column A in worksheet 2 has the following 3 entries starting with row 1 (M, M2,MPNL).
Entries that match need to be lined up with all the relative data in that row. So the quantities for products M, and M2 would line up since they match in both rows. In worksheet 1, the third entry is MF2. Worksheet 2 doesn't have a MF2. I would like for excel to insert an entire row in worksheet number 2, this way, all the information from the MPNL row in worksheet 2 would bump down to row 4, where it would match up with the MPNL row from worksheet 1. I need this function to work both ways from worksheet 1 and worksheet 2, as the data will be inconsistent.
I hope this makes sense. Let me know if you have any questions.
As I understand you would need to compare the revised quantities with the base quantities of each product and then find the change in quantity.
If the above is correct then you could do the following (assumed your sheet names are revised_sheet and base_sheet):
Add another sheet in your WorkBook and name it something meaningful (say, product_movements for the sake of this answer)
Add all your Material ID and Material Description in Column A and Column B of this new sheet - product_movements.
Do a vlookup in Column C =VLOOKUP(A2,revised_sheet!A:C,3,0) (row 2 assumed) to get the revised quantity
Similarly, in Column D use the formula =VLOOKUP(A2,base_sheet!A:C,3,0) to get the Base Quantity.
In Column E you could do =C2-D2 to get the Change of Quantity
Now you can add all sort of Conditional Formatting to highlight appropriate changes.
Note: If you want formula in column E to work you need to keep your Quantity Columns as number only.

Resources