Hello I am trying to use countif to add up how many cells have January in. For example I have 40 worksheets and I need to find out how many of them contain january in the date in cell C3 on all of the sheets. and put the answer in another sheet.
OPTION 1) Formula Method
1) Write out a list of all the names of your sheets in a column.
2) On the "Formulas" ribbon, select Define Name.
3) Give it a name in the top box, ie. SHEETNAMES
Then use this formula:
=SUMPRODUCT(COUNTIF((INDIRECT("'"&SHEETNAMES&"'!C11")),"Completed"))
I would have thought the formula for your original question would have been very similar but it keeps showing up as an error. I have been using the following:
=SUMPRODUCT(--(MONTH(INDIRECT("'"&SHEETNAMES&"'!C3"))=1))
You can use a 3-D formula, but unfortunately, the only formulas that allow 3-D references are mathematical functions that don't have much in the way of logic (no IFs, ANDs, etc.). If you restructure your workbook a little bit to, say, add IF(C3="January",1,0) in Z3 on each sheet, then you can do SUM(Sheet2:Sheet40!Z3) on your summary sheet.
Related
I am trying to list all sheets in an Excel workbook with a method that works for macro-free workbooks such as .xlsx files.
I am aware of the following options although both require the workbook to be saved in a file format that allows macros:
Method 1: Excel 4 Function
See this answer I posted.
Method 2: VBA
See this answer posted by another user.
Is there any option to list all sheets? If not is there any formula that names any sheet beyond the sheet containing the formula?
If you have the flexibility, you can use the formula from #urdearboy in e.g. A1 on each sheet, then use a 3D reference to collect them together e.g. =TEXTJOIN(CHAR(10), FALSE,'FirstSheet:LastSheet'!A1) and then extract from the string.
It's a big kludge but it does work. (But at the moment I'm happy with all the sheets listed in 1 cell; A1 contains sheetname + description)
Caveat - FirstSheet & LastSheet must obviously span the range of sheets to be listed, and if they get moved around, the 3D reference may be inappropriate or break
This is a great question in the context of building macro-free workbooks.
To make an contents list of sheetnames, the formula from #urdearboy can be pasted in cell A1 of each sheet being indexed:
=MID(CELL("filename",A1),FIND("]",CELL("filename",A1))+1,255)
If cell A1 of each of these sheets is made a named range, using foo_1, foo_2, foo_3 etc as the names, the index is simply =foo_1 in the first cell of the contents range, or better =indirect("foo_", 1), with 1 replaced by a cell reference to a number sequence.
The content list stays up-to-date, even if the sheet names are changed.
I am trying to figure out how to reference a worksheet name in my SUMPRODUCT cell and I can't figure it out. I am not sure if its because my logic is flawed and there is a better way or if what I want to do isn't possible without using VB code.
Basically I have a workbook that has various data. However for this instance I am only looking at a single column, in this case, the DATE. So I am basically using a SUMPRODUCT Formula to read the entire column for a date that is older than 120 days, but not counting items in the column that are blank. So just cells with a date in it.
This workbook will have worksheets added every month and the previous month will be stored. To make this workbook Dynamic, the first work sheet has various graphs to display information and so it can be printed nicely while the last page has all the formulas.
Basically I looking to create a drop down box on the first worksheet. That dropdown list will have the previous months (the worksheets are named by months), and ideally they will be referenced into the formula as it changes.
For example:
My current formula works: SUMPRODUCT(('OCT 2015'!$G:$G<TODAY()-120)*('OCT 2015'!$G:$G<>""'))
I would like the formula to like: SUMPRODUCT(('CELL_THAT_HAS_SHEETNAME'!$G:$G<TODAY()-120)*('CELL_THAT_HAS_SHEETNAME'!$G:$G<>""'))
And that cell it will reference is a dropdown list and corresponds to the sheetname.
You would incorporate the INDIRECT Function:
=SUMPRODUCT((INDIRECT(A1&"!$G:$G")<TODAY()-120)*(INDIRECT(A1&"!$G:$G")<>""'))
i have a specific problem to solve. I dont know how to do it but want to do it without macro or worse without VB script.
I will explain what i have and then what i want to do.
I have (plan to have) many sheets in worksheet. first sheet is some intro sheet, where i have also one column containing name of sheets in every cell. i am using formula "=MID(CELL("filename",A1),FIND("]",CELL("filename",A1))+1,256)" so i can change name of sheet and it will change also name of sheet in intro sheet cell.
so for imagination i have column N and there i have sheet1, under that sheet2 and so on...
Each of sheets have the same construction and same formulas on the same place, so i have each sheet for every goods.
And now what i would like to have. I want to add a formula into intro sheet where i would summarize SUM (add) or something like that. It would take every value form each sheet on the same place on each sheet. so the formula would look something like this: "=sheet1!C4 + sheet2!C4 + sheet3!C4 + .... + 'any sheet'!C4" but i dont know how many sheets i will have and the number will sometimes change and i dont want to edit formula because i plan to have more this kind of dynamic formulas.
i will just add another sheet into column N and every formula using this excel type for cycle would take and recount formula using this dynamic array. i hope you understand what i want. my problem is much more complicated but when i describe it more into detials you would loose the point of my interest.
thanks for any suggestions
edit: but if there is only a solution using VBA script, i will have to use it. i dont want to change formula everytime i add another sheet into worksheet
What you describe is a 3D formula. You can do something like
=SUM(Sheet1:Sheet4!A1)
Excel will sum cell A1 in all sheets from Sheet1 to Sheet4 and any sheets that are between these two. You can insert new sheets and they don't have to be named SheetX.
In order to manage the 3D formulas more efficiently, you could use two sheets like bookends before and after the sheets you want to include in the formula: Insert two sheets called "First" and "Last" and ensure that all sheets you want to sum are arranged between these two sheets. Then on your intro sheet use
=SUM(First:Last!A1)
You can hide the "First" and "Last" sheets and only unhide them when you need to check your sheet arrangements for your formulas.
You can insert new sheets and make sure that they are located between your bookend sheets. Drag sheets in and out between the bookends to include or exclude them from the 3D formula.
In Excel 2007 I use the following formula to refer to cells in other worksheets in the same workbook:
=INDIRECT($B$2&"!A9")
B2 contains the name of the worksheet containing the target cells (I want to turn this into a template, so I don't enter the name into the formula). The formula works, but I want to use this same formula over multiple rows (A10, A11, A12 [...] A1000). I am using this same code over multiple rows but with different fields (B9, C9 and so on), with a variety of different content types (data, number, text).
An alternate version of the formula is as follows:
='Worksheetname'!A9
But again, this requires hard-coding the name of the worksheet, which is not desirable for me.
Because of the sheer volume of the rows manual editing is not an option: is there any way to alter this formula so I can easily use it over multiple rows? Preferably without the use of VBA, but that is not a requirement.
If your records are located in the same cells in both worksheets, then you can use something like following:
=INDIRECT($B$2&"!"&ADDRESS(ROW();COLUMN()))
IF now, then you can easily offset them using given ADDRESS function
P.S. Please be aware with INDIRECT function that it slows down calculation performance on your workbook (few functions are OK, but if you have 10,000 of them then you might see some delay)
If you want to use the same formulas for several columns as well you could include something like this:
=INDIRECT("'"&$B$2&"'!"&ADDRESS(MATCH($B4;INDIRECT(CONCATENATE ($B$2;"!";"B:B"));0);MATCH(B$3;INDIRECT(CONCATENATE($D$2;"!";"A3:AR3"));0)))
B2=reference to sheet name
B4=first row for your data
B3=Column header
For those who want to pull all the same column of data from multiple sheet that have the same layout (and have each cell linked), it took me hours to work it out, but actually can be solved with a relatively simple way:
=OFFSET(INDIRECT("'"&G$2&"'!l7"),$A6,0,1,1)
The Indirect part take you to the right sheet and right cell, G2, H2 ... has the Sheet names (be mindful of sheet name with space, you will need to use ' ', which is the case for my workbook), and L7 cell of that sheet, and I want L8, L9, ----L200 all being pulled through;
Offset help you navigate the range of rows, A6 is an additional numbering row I added to move to the right row in each sheet.
Hope it help!
I have multiple worksheets all using the same template
I have a summary page and have a formula that works for an individual sheet
=SUMPRODUCT(--(sheet1!F4:sheet1!F500>=A1),--(sheet1!F4:sheet1!F500
the formula checks the relevant ranges on sheet 1 and returns the values in the boxes in the date range specified in A1 and A2
The problem is that I want to do this for multiple sheets and use a 3D reference.
I have tried
=SUMPRODUCT(--(sheet1:sheet3!F4:sheet1:sheet3!F500>=A1),--(sheet1:sheet3!F4:sheet1:sheet3!F500
and also thrown in some extra brackets to be safe
=SUMPRODUCT(--((sheet1:sheet3!F4):(sheet1:sheet3!F500>=A1)),--((sheet1:sheet3!F4):(sheet1:sheet3!F500)
neither of these work and I am getting the #NAME? error
any ideas would be appreciated
Thanx in advance
Gary
Your formulas look like they are truncated, are you just trying to count dates between A1 and A2 inclusive? You can't use 3D references in SUMPRODUCT. In Excel 2007 you could use this formula
=SUMPRODUCT(COUNTIFS(INDIRECT("'"&G1:G3&"'!F4:F500"),">="&A1,INDIRECT("'"&G1:G3&"'!F4:F500"),"<="&A2))
where you have all your sheet names listed in G1:G3