I am new here, so apologies if this has been answered before.
I am trying to create a VBA script to transform cells using SUMIFS to pull data to individual cell references.
Ie. if I pull a value from another tab using a SUMIFS function, I want the output to be exactly the cell it is referenced (=cell).
Specifically, I am thinking of:
Read all cells in a sheet,
Identify which cells pull value with a SUMIFS function
Get the cell reference from which the data matching the SUMIFS is sourced
Convert the SUMIFS formula to the matching cell reference (ie. =A35)
I am trying to see individual codes for this, but not sure where to begin with, or if this has been previously solved.
Any thoughts will be highly appreciated!
Thank you!
Tried the above steps
Related
I'm building the budget template in Excel. In the Summary sheet, I want to sum columns from different worksheets by the corresponding cell.
enter image description here
In my way, I get all sheet names (by VBA code, it will automatically update when creating new worksheets), then use TEXTJOIN to have all reference cells I want in a text. It looks like this: Sheet1!$B$2,Sheet2!$B$2,Sheet3!$B$2,Sheet4!$B$2,Sheet5!$B$2,Sheet6!$B$2,Sheet7!$B$2
I guess we can have some way to put that text in SUM function in Excel to sum up all reference cells value, but I haven't found how to do that yet.
If anyone can have a look and give me a solution, it's much appreciated.
Thank you as always
As I understood the question you can do like this in reference cell:
=SUM(Sheet1:Sheet7!C2)
=SUM(Sheet1:Sheet7!C3)
=SUM(Sheet1:Sheet7!C3)
=SUM(Sheet1:Sheet7!C5)
=SUM(Sheet1:Sheet7!C6)
--------
I have a formula that sums one column based on a criteria from another column. This formula works fine:
=SUM(SUMIFS(sheet1!C:C,sheet1!A:A,{1, 7}))
However, i need to be able to use a cell reference which will contain the {1, 7}
So the formula will look like this:
=SUM(SUMIFS(sheet1!C:C,sheet1!A:A,M2))
But this returns a zero, when evaluting the formula it pulls the contents from the cell but wraps it in "" which i think is where the issue is happening.
I've tried adding formula to remove the quotes, and trying to pull the contents differently, but still the same.
Any help would be greatly appreciated.
Figured out a way round this.
I created a named range called condition, and assigned =Evaluate($M2).
Then I used this formula =SUMPRODUCT(SUMIFS(sheet1!C:C,sheet1!A:A,Condition))
This picks up all numbers used in M2, and works on all rows below with the Evaluate formula following.
Thank you to everyone that assisted with this.
This link helped aswell: Excel SUM of SUMIF/SUMIFS with dynamic multiple criteria
Is it possible to output the result of a formula on a different cell without the use of VBA and without directly reffering to the cell containing the formula (e.g. writting =C1 into the output cell)?
I know that this can be easily done with the help of VBA, but I was wondering if there really is no simpler way to achieve this.
I don't think so, if you dont want VBA then all I can think of is to lock the cells so they can't be updated.
How to lock just a range of cells
As far as I know all formulas display their results within the cell they occupy.
if you want to pull a value from a cell without directly referencing the cell address, you could indirectly by using the offset function. However even the offset function needs to reference at least one cell on the worksheet.
I am creating a work chart for a project with excel table. However with so many people to manage I have ran into an issue of often putting same person twice on different columns of the same row (he/she can't work on two places at same time!)
So, I am looking for help with a formula that notices if the same name appears twice on a row but does not count multiple blank cells as duplicates. My understanding of excel is very basic and so far I have managed to get this far
=COUNTIF(A6:W6;A6:W6)=1
which returns to me with false, which I assume is because of the blank, unfilled cells still within the table being counted as duplicates.
Help would be appreciated, thanks.
You can't have a range as the second argument of a Countif. The range you pass into the formula will resolve to just the first value. Use the Evaluate Formula tool to see what I mean.
If you want to determine if ANY name in the range A1:W1 appears more than once (and exclude blanks), you will need a recursive function. That can only be done with VBA, not with a formula.
You could use a Countif in a conditional format to highlight duplicate names in a row. That's a piece of cake. Pipe up if you want to do that.
I'm trying to utilize a row and a column header to build a function that I can fill across an excel table (range of cells, not excel table object). So, for example I have a row header "BAT61" and column headers "A","B","C"...
I'd like to create a formula that generates the following results in those columns: =min(BAT61A),=min(BAT61B), =min(BAT61C)... Where those generated names match named ranges that have already been created.
I've attempted to use =index without success (I generally get a #ref error). I'd prefer a non-vba solution, if at all possible. Any help is appreciated.
UPDATE:
I've tried the indirect function but gotten the same #ref error. I've verified that the named range exactly matches the text string I'm trying to pass. I've tried the following variations with the same result #ref: =min(indirect(A1))[where A1 is the cell with "BAT61A"], =min(indirect(BAT61A))[to try and get the result directly], and =min(indirect(A1&A2))[where A1="BAT61" and A2="A"]. But, when I create a "Test" range, like suggested-it works. Any further ideas would be appreciated.
UPDATE2: I was able to get it working with several slight modifications. My named ranges that did't work were actually referring to fairly extensive array formulas that were parsing select rows from a table. When I created new dummy columns in the table that basically did the filtering, the indirect would pull the correct columns based upon the indirect.
Name some cells "Test" then you can use:
=MIN(INDIRECT("Test"))
http://www.cpearson.com/excel/indirect.htm
The name can be constructed using the & operator = $A1&B$2
For reference of others, use the function "Address" and "Indirect" in combination to achieve the above behavior.
Here is a sample for using values in cells to create formulas
=INDIRECT(ADDRESS(E6,K2))
Assuming cell
E6 holds 3 and
K2 holds 4
The above formula will return
=INDIRECT($C$4)
Assuming cell
C4 holds This is a test
The above formula will return
This is a test