Using If statement in excel to sum cells in multiple sheets - excel

I am currently working with 3 sheets in excel. They are called Sheet1, Sheet2, and Summary. In Sheet1 and Sheet2, I have a list of states with a column for revenue. In the Summary sheet, I want to do an SUMIF statement as if the state in Summary is in Sheet 1 and 2, then I would like to add both revenue amounts together. So if the state of PA was in the Summary page, and it showed up in Sheet1 and Sheet2 then I would like to add both cells together. Now if it showed up in just Sheet1, I would still like to have it add it to the Summary page as it should be just adding a 0 since it is not in Sheet2. Any help with this would be great. I have used COUNTIFs before but I cannot seem to get this to work correctly. Thanks!
Demo

I assumed few things here:
Assumptions:
Sheet1 has state names in Column C and corresponding revenue in Column D
Sheet2 has state names in Column C and corresponding revenue in Column D
Summary sheet has state name in cell C6 and you want to see the total revenue of states (from sheet1 and sheet 2) in column D of Summary sheet.
To do this use this formula in cell D6 of Summary sheet. You may need to modify the range of table which i assumed "C4:D5". It may be different for you.
=IF(ISERROR(VLOOKUP(C6,Sheet1!C4:D5,2,FALSE)),0,VLOOKUP(C6,Sheet1!C4:D5,2,FALSE))+IF(ISERROR(VLOOKUP(C6,Sheet2!C4:D5,2,FALSE)),0,VLOOKUP(C6,Sheet2!C4:D5,2,FALSE))
Based on more description here is the updated formula:
SUMIF(Sheet1!$B$3:$D$11,Summary!C3,Sheet1!$D$3:$D$11)+SUMIF(‌​Sheet2!$A$3:$B$11,Su‌​mmary!C3,Sheet2!$B$3‌​:$B$11)

Related

How to count and then vlookup?

I have two spreadsheets and I want to sum up the total and then vlookup but when I do it I get 0 as a result.
Basically I have all 12 weeks, so I want to sum up all the numbers for "week 1" then vlookup the total to the other spreadsheet. the spreadsheet I want to sup up, so 7x10 = 70
the overview spreadsheet I want to get the "70" from week 1
You don't need a Vlookup, because you have many values for week 1, and no identifier for the week 1 total. Instead, on the summary sheet, you can use a Sumif() or Sumifs() function. Something along the lines of this:
=Sumifs(Sheet1!C:C,Sheet1!A:A,Sheet2!A3)
In words: Sum up all the values from Sheet1 in column C where column A in Sheet1 has the same value as cell A3 on Sheet2.
You need to adjust the sheet names and cell references to reflect your workbook.
With that approach, you do not need to enter weekly totals into your first sheet at all. It's not good practice to interrupt a table of data entry cells with formulas. It's better to do the reporting and analysis outside of the data entry table.

Copy rows from one sheet into another depending on value in cell

I have two sheets in my spreadsheet and I'm looking for some VBA code (or a simple formula) to batch copy values from one sheet into the other.
Sheet1, has a list of cities, markets and products in three columns (A-C). Close to 19,000 rows in total.
Sheet2, has a list of products, product sub-category, and product origin (columns A-C), Close to 300 rows in total.
I would like to copy product sub-category and product origin (i.e. columns B and C in Sheet2) into Sheet1 where Product in Column C of Sheet1 = Product in Column A of Sheet2. Noting that I would like to keep the order that the rows are in Sheet2 when copying to Sheet1.
I tried the following INDEX/MATCH approach, but it stops working after the 18th row (I have close to 19,000 rows in Sheet1), and it only works for one column at a time.
=IFERROR(INDEX('Sheet2'!$B$2:$B$284, SMALL(IF($D2='Sheet2'!$B$2:$B$284, ROW('Sheet2'!$B$2:$B$284)-1,""), ROW()-1)),"")
Example output using the sample data:
if it is just copying static data repeatedly then perhaps something like this. If not, then i misunderstood your question.
this is the formula in cell B2:
=INDEX(Copy.Table,IF(MOD(ROW()-ROW($B$1),Table.Count)=0,$E$2,MOD(ROW()-ROW($B$1),Table.Count)))

Excel categorize list transfer

I'm trying to create a summarize information for all of the supplier our company have. I have my sheet1 as my main database where in all our suppliers are listed. I would like to create several additional sheets which will contain each specific nature of business of the suppliers.
What I would like to happen is, given that my sheet2 is for the suppliers who specialize in "PRINTING", sheet3 is for those who specialize in "I.T EQUIPMENT". Whenever I add a supplier on my sheet1, it will automatically be added on my sheet2 or 3 as well if it matches its specialty. Please help!
Thank you in advance!
Considering your Sheet1 is Master Sheet where names of all Suppliers and their Specialties are listed in Column A and Column B respectively.
If in Sheet2 you want to list down the all Suppliers with Printing as specialty, write following formula in Cell A2 of Sheet2
=IFERROR(INDEX(Sheet1!A$2:A$25,SMALL(IF(Sheet1!B$2:B$25="Printing",ROW(A$2:A$25)-ROW(A$2)+1),ROWS(A$2:A2))),"")
and drag/copy it down as required. This is an array formula so enter this formula by pressing Ctrl+Shift+Enter.
Likewise, if in Sheet3 you want to list down all Suppliers with IT Equipment as specialty, write following formula in Cell A2 of Sheet3
=IFERROR(INDEX(Sheet1!A$2:A$25,SMALL(IF(Sheet1!B$2:B$25="IT Equipment",ROW(A$2:A$25)-ROW(A$2)+1),ROWS(A$2:A2))),"")
and drag/copy it down as required. Again, this is an array formula so enter this formula by pressing Ctrl+Shift+Enter.
To automatically update the list in Sheet2 and Sheet3, you'll have to take care of two things:
1. Range in the above formula is row 2 to row 25, you'll have to enter the range till the row you think your list could be extended. For example if your list will not get past the row 1000 then formula for Printing in Sheet2 becomes
=IFERROR(INDEX(Sheet1!A$2:A$1000,SMALL(IF(Sheet1!B$2:B$100="Printing",ROW(A$2:A$1000)-ROW(A$2)+1),ROWS(A$2:A2))),"")
2. You'll have to drag/copy down this formula in Sheet2 and Sheet3 till the row you think the list could extend based on the Sheet1 data.
You can even use just one formula for all the sheets as follows:
=IFERROR(INDEX(Sheet1!A$2:A$25,SMALL(IF(Sheet1!B$2:B$25=$C$1,ROW(A$2:A$25)-ROW(A$2)+1),ROWS(A$2:A2))),"")
where Cell C1 of each sheet will have the specialty name.
See image for reference

Automatically feed data from multiple columns to another sheet's multiple rows

I have two sheets in Excel:
Sheet1: Contains a list of names, month of payment and the payments made by them i.e Name, House No, Payment. (3 columns)
Sheet2: Contains a receipt format which is going to be printed. It has three fields empty which are Name, House No, Payment. (3 rows)
What I want to do is when a list is made manually in Sheet1, the data from there automatically goes to Sheet2 and places itself in its respective places i.e name from Sheet1 to name in Sheet2.
I studied VLOOKUP and INSERT and MATCH but I'm not getting the hang of it.
Can someone please explain how things should work?
I'm guessing that for printing a receipt you only want one row fro one sheet into one column of another at a time, so in your second sheet, assuming Name is in A1 on each sheet, select B1:B3 and:
=TRANSPOSE(Sheet1!A2:C2)
entered with Ctrl+Shift+Enter
This replicates whatever is in Sheet1 A2 into Sheet2 B1, in Sheet1 B2 into Sheet2 B2 and so on.
Alternatively in Sheet2 B1:
=Sheet1!A2
in Sheet2 B2:
=Sheet1!B2
in Sheet2 B3:
=Sheet1!C2

Excel - How can I populate sheet1 with corresponding data from sheet2

I'm not really sure how to go about this. I want to populate Sheet1 with the corresponding refid from sheet2 when there is a match on id column:
Sheet2 only has 1 entry for each id and unique corresponding refid. Sheet1 may have mulitple entries for a given id
Sheet1:
Sheet2:
An explanation of how I could carry out an operation like this either as a formula or through vba would be greatly appreciated.
Use the following formula in cell B2 in Sheet 1 and copy it down:
=vlookup(A2,Sheet2!$A$2:$B$7,2,0)
It is not necessary for the values in Sheet 2 to be sorted by the id column.

Resources