I'm trying to sum a specific column in that repeats in some sheets with Macro Excel and I'm quite lost...
I have 10 different sheets and in each one the column that I'm trying to sum is in a different letter. Also, each sheet has a dynamic count of rows.
Could you show me what code I need to write to sum the column in all the sheets at once?
Thank you so much!
You can use this formula to sum or do anything in other sheet:
Example you want to sum the value from A1:A5 in Sheet1 and store it in the B3 in Sheet2, you can use this formula in cell B3 in Sheet2 like this:
=SUM(Sheet1!A1:A3)
Best,
Tung Duong (Thomas)
Related
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.
I have multiple sheets that have the same layout but have different products and quantities on each sheet.
Then I have a different sheet that I'm using to total all the other sheets quantities per product I'm using this formula
=SUMPRODUCT(SUMIF(INDIRECT("'"&D$8:D$10&"'!B3:B6"),B3,INDIRECT("'"&D$8:D$10&"'!A3:A6"))) Which works fine.
How can I sum all the product quantities from the same sheet more than once, For example if I add the number of times I want to multiply the sheet In column E next to each sheet name and I put a qty of 2 in E8 it would then double the quantity for that sheet well still summing all the other sheets.
You can use Named Ranges for this. Give the Cell "E8" a name - "Takeoff1_Multiplier" and in the Sheet Takeoff1, go to cell "A3" and in the formula bar enter
the formula =1*Takeoff1_Multiplier.
Now, when you change the value in "E8", the value in "A3" will be multiplied.
If you don't want to use a formula in the Column A in the Takeoff1 sheet, use the formula in column c as =A3*Takeoff1_Multiplier and drag this formula for all the rows.
Resources:
Named Range: https://support.office.com/en-us/article/define-and-use-names-in-formulas-4d0f13ac-53b7-422e-afd2-abd7ff379c64
=SUMPRODUCT($E8:$10*SUMIF(INDIRECT("'"&D$8:D$10&"'!B3:B6"),B3,INDIRECT("'"&D$8:D$10&"'!A3:A6")))
or
=SUMPRODUCT($E8:$10,SUMIF(INDIRECT("'"&D$8:D$10&"'!B3:B6"),B3,INDIRECT("'"&D$8:D$10&"'!A3:A6")))
Both methods should work. Basically you are weighting the results of each sumif sheet result by the corresponding number n your table before taking the final sum/grand total.
I'm dealing with Excel VLOOKUP and COUNTIF that gets the count of number of entries in first column of every sheet and display the results in separate sheet accordingly with the product
Example:
I have 4 sheets in excel (4 sheet related to 4 products say oldnavy/purell/BB/Macys)
Each sheet has multiple columns.
Im looking to get just get the count of number of rows in first column for all 4 sheets and place in fift sheet with product name in each row and count of it
Tried using VLOOKUP and COUNTIF
Any help would be greatly appreciated
If you're trying to dynamically reference worksheets, you need to use INDIRECT().
If, in Sheet5 you have your worksheet names "oldnavy/purell/BB/Macys" in A1:A4 respectively, then in cell B1 you could put
=COUNTA(INDIRECT("'" & A1 & "'!A:A"))
And drag it down. COUNTA counts all non-blank cells in a range.
If I understand correctly, do this:
=COUNTIF(Sheet1!A:A,"<>")
I believe you understand COUNTIF()
Condition "<>" basically means 'not equal to empty/nothing', so 'count all that is not empty'
Hope that helps
I want to know how I can do the following without using an if formula in excel.
Let's say this is sheet 1 [Data]:
On sheet 2, I want the numerical values like this:
In this case an if statement would not be too complicated, but I need to do this with 20 values and 30 rows with 10 columns of data.
Is this possible or am I in for the mother of all if statements?
You can also use a VLOOKUP function.
On Sheet2, put this formula in cell A1 and copy/paste into the other cells.
=VLOOKUP(Data!A1,Data!$G$1:$H$3,2,FALSE)
You can try:
=MATCH(Sheet2!A1,{"Bad","Caution","Good"})
And fill all the area.
I have an excel workbook of +40Mb. Reason is several sheets that use formulas over a range of 30 columns and 20000 rows. I want VBA to calculate these cells in stead the 600000 formulas.
What I need is a VBA script to calculate to following:
Column A row 2:
"=IFERROR(IF(MATCH(Sheet1!G3;Sheet2!K3:AE3;0);1;0);0)"
Column A row 3:
"=IFERROR(IF(MATCH(Sheet1!G3;Sheet2!K4:AE4;0);1;0);0)"
...
Column A row 20000:
"=IFERROR(IF(MATCH(Sheet1!G3;Sheet2!K20001:AE20001;0);1;0);0)"
Column B row 2:
"=IFERROR(IF(MATCH(Sheet1!G4;Sheet2!K3:AE3;0);1;0);0)"
Column B row 3:
"=IFERROR(IF(MATCH(Sheet1!G4;Sheet2!K4:AE4;0);1;0);0)"
...
Column B row 20000:
"=IFERROR(IF(MATCH(Sheet1!G4;Sheet2!K20001:AE20001;0);1;0);0)"
And so on for the other columns.
Can anyone help with this? I'm a newbie to VBA and have no clue where to start.
Many thanx in advance!
Given what you requested, I think your easier solution would be to still let Excel do the heavy lifting, but not keep it as Excel formulas once you're done (ie convert it to values).
That being the case, this should do it:
Sub PutInFormulas()
ActiveSheet.Range("A2").Formula = "=IFERROR(IF(MATCH(OFFSET(Sheet1!$G$2;COLUMN();0);Sheet2!$K3:$AE3;0);1;0);0)"
ActiveSheet.Range("A2").Copy ActiveSheet.Range("A2:AD20000")
ActiveSheet.Range("A2:AD20000").Value = ActiveSheet.Range("A2:AD20000").Value
End Sub
Basically, your first step is to make it a formula you can paste down and across, so you replace your Sheet1!G3 with an Offset() reference that increments one row for each column you move across (In other words, any formula in Column A will reference G3, column B will reference G4, etc.) and to put that formula in cell A2
Next you copy it across to your entire range
Finally your convert the formulas to values.
Hope this makes sense / does the trick!!