Problems with Excel function SUM.IF - excel

I want to sum a column of an Excel tab (depending on the content of another column) which can have different names.
Therefore I dynamically build the name of the tab and then use it in the SUMIF-function.
However, I get #REFERENCE! error and I don't know why?! I can reference single cells this way but not a range which I have to in this case. Can someone see what I'm doing wrong or maybe help me with a workaround?
=SUMIF(INDIRECT(CHAR(39)&Settings!$D$3&"-V"&L$7&CHAR(39)&"!B3:B100";FALSE);B44;INDIRECT(CHAR(39)&Settings!$D$3&"-V"&L$7&CHAR(39)&"!H3:H100";FALSE))
Area to sum as you can see below:-
Cell where I want the sum to be:-

=SUMIF(INDIRECT("'"&YEAR($E$5)&"-V"&L$7&"'!$M$3:$M$10"),"*"&$C9,INDIRECT("'"&YEAR($E$5)&"-V"&L$7&"'!$O$3:$O$10"))
This is the correct use (note I have used the actual character ' instead of CHAR(39))
The wildcard is used to match anything before the cells content as your data contains PL before it and also note the use of absolute referencing.
You will need to change the , to ; to match your regional settings...

Related

Dropdown list with a conditional statement

I have some materials in column B, a few among these are in a Table definition called Material_List. In D49 I am trying to write a conditional statement such that, if the data in B49 already exists in the table definition, then print the header name or else INDIRECT($49). C49 has the independent dropdown list and D49 will be the dependent.
In D49 I have used the following formula within the Data-->Data Validation-->Source=
=IF(MAX((ISNUMBER(MATCH(Material_List;$B49;0))*COLUMN(Material_List)))=0;
INDIRECT($C49);
INDEX(Material_List[#Headers];1;MAX((ISNUMBER(MATCH(Material_List;$B49;0))*
COLUMN(Material_List))))))
with Allow=List. But it says Error "There is a problem with this formula"
When typed the following formula in cell D50 directly, it works well but obviously without dropdown.
=IF(MAX((ISNUMBER(MATCH(Material_List;$B50;0))*COLUMN(Material_List)))=0;
INDIRECT($C50);
INDEX(Material_List[#Headers];1;MAX((ISNUMBER(MATCH(Material_List;$B50;0))*
COLUMN(Material_List))))))
I am trying to build a dropdown list based on the mentioned criteria. could anyone please tell what is wrong with my formula?
I think the main issue with your formula is that you cannot use table references in the data validation.
Don't ask me why. I think it is just an outstanding Excel bug which hasn't been fixed yet. Please see this link for further info: https://exceloffthegrid.com/using-an-excel-table-within-a-data-validation-list/
The best way I have found to work around this is to create a named range which refers to the table references you need ("Material_List" and "Material_List[#Headers]" in your case). Then you can use those named ranges in your data validation instead of the table references directly.
However, I think there are also other issues with your formula. For example, this part:
MATCH(Material_List;$B50;0)
Normally a MATCH would be in the format of:
MATCH(<single value to look for>, <range to look in>, 0)
You appear to have that reversed, meaning that it should always return a #VALUE! error.
Also, I don't think you can use match on a 2D array, so if your "Material_List" table is more than a single column, that would also cause it to return a #VALUE! error.
UPDATE:
The way I would tackle dependent dropdowns would be as follows.
I would create a "Material_List" table similar to below (could be on a hidden sheet):
Then I would create 3 named ranges.
One for the table body range, called "MaterialList_TblRange":
=Material_List
One for the table header range, called "MaterialList_TblHeaderRange":
=Material_List[#Headers]
And one to refer to the dependant dropdown options, called "DropDownOptions" (this is by far the most complicated part):
=INDEX(MaterialList_TblRange,1,MATCH(Sheet1!$B23,MaterialList_TblHeaderRange,0)):INDEX(MaterialList_TblRange,COUNTA(INDEX(MaterialList_TblRange,1,MATCH(Sheet1!$B23,MaterialList_TblHeaderRange,0)):INDEX(MaterialList_TblRange,ROWS(MaterialList_TblRange),MATCH(Sheet1!$B23,MaterialList_TblHeaderRange,0))),MATCH(Sheet1!$B23,MaterialList_TblHeaderRange,0))
I will explain what this is doing in a moment.
The last step is to set up the data validation where we want our lists.
Where we want the master lists to appear, we can simply enter:
=MaterialList_TblHeaderRange
And the defendant dropdown validation can be entered as:
=DropDownOptions
This is the result:
Now back to the long "DropDownOptions" named range formula...
Basically, we use INDEX:INDEX to select the first/last cell in the range we want to use in out dropdown.
The first INDEX:
=INDEX(MaterialList_TblRange,1,MATCH(Sheet1!$B23,MaterialList_TblHeaderRange,0))
Simply selects the first cell from the column whose header matches the selection in our first dropdown.
The second index does the same, except that instead of selecting the first cell in the column, it counts the number of cells that contain text and uses that as the last cell in the range.
This does mean that we mustn't have any gaps in this table, otherwise an option might be missed off the end.
I hope this makes sense.

Excel data validation by typing instead of selection

I am struggling with the autocomplete list in my excel document.
I was trying to use the example from OzGrid
https://www.ozgrid.com/Excel/autocomplete-validation.htm
But it seems like this step is not explained well enough.
First of all, I did step one by linking my cells between these 2 sheets.
[![enter image description here][1]][1]
In both "Frontsheet" and "Locality" the list range is from C51 to C67, as per the OzGrid advice.
Next the step with [Dynamic Ranges][2] probably refers to older versions of Excel with traditional menu, where we could select the "Tools" from the bar. Now in Excel 2016 I believe, that it should be like follows:
Formulas - Name manager - New... where we put our name, scope and refers to (range). I have created the Myrange
[![enter image description here][3]][3]
and finally, I put the formula (assuming that the C50 is my dropdown list cell):
=OFFSET(Frontsheet!$C$50,0,0,MATCH("*",Frontsheet!$C$51:$C$67,-1),1)
but I am getting nothing apart of #N/A
I don't know what's next.
I don't want to use VBA this time, because I want to have these lists allocated to the specified cells. I want to search the records by typing not by selecting since I have got them quite a lot. Is it possible?
This question is somewhat a duplicate to the previous ones, which unfortunately didn't bring me the solution.
Excel 2010: how to use autocomplete in validation list
Excel data validation with suggestions/autocomplete
Your formula =OFFSET(Frontsheet!$C$50,0,0,MATCH("*",Frontsheet!$C$51:$C$67,-1),1) shouldn't return anything but #N/A when entered in a cell because it defiens a range which Excel can't display in a single cell. However, you can use it to define a named range and then use that name to define a Data Validation list.
MATCH("*",Frontsheet!$C$51:$C$67,-1) doesn't work reliably if there are numbers in the lookup range. You might replace it with COUNTA(Frontsheet!$C$51:$C$67) which can deal with numbers or text equally well. The difference is that MATCH will produce the entire list, including intervening blanks, while COUNTA will truncate the list at the bottom by as many rows as there are blanks higher up. Either way, one usually avoids blanks in the source for a validation list.
If you want the user to be able to either choose or enter, you must disable Show alert after invalid data is entered on the Error Alert tab of the Data Validation dialog box, where you set up the validation rules.
The OzGrid solution is poorly written and deceptive. It is simply capitalizing on AutoComplete for cell values. There is no magic in linking to another sheet and using offset or in creating a named reference.
All you need to do is add a list of values you intend to use in the column above the column. Avoid empty rows between this list of 'default' values and what you intend to enter.
Skipped rows 'break' AutoComplete for cells.
But can be resolved by adding an adjacent contiguous 'indexing' column.

Excel Vlookup , too few arguments error

When I try to enter Vlookup formula manually in Excel, I get the following error;
excel manual vlookup error. This error appears while I'm defining the second element of the formula from another excel file and it doesn't let me to define the area.And it directs me to use formula wizard, however it's not useful and efficient for me. Has anyone experienced this problem before?
You may find the formula I try to use as below;
=vlookup(S2;'[Copy of Material Master_S112.xlsx]q_S112'!$G$2:$I$7
after this point it doesn'let me to make any change and directs me to formula wizard.
Thank you for your help in advance
VLOOKUP() takes 4 arguments:
Value to seek.
Target range.
Number of result column relative to the first column of target range. E.g. if your target range is $G:$I and you need results from column H this parameter should be 2, if you want results from column I - then 3.
Parameter specifying whether you need exact (TRUE) or approximate (FALSE) match. Set it to FALSE in most cases.
And of course you need closing parenthesis ) at the end.
So the correct formula should look something like this:
=VLOOKUP(S2;'[Copy of Material Master_S112.xlsx]q_S112'!$G$2:$I$7;3;FALSE)
If you use Ctrl-Shift-Down after you have started to enter the second parameter you will get the "you have entered too few arguments" message.
You can only use Ctrl-Shift-Down after selecting a cell but before you have entered anything for the second VLOOKUP parameter.
As I mentioned in my comment, arguments in Excel formulas are separated by commas, not semicolons.
For example,
=VLOOKUP(S2, '[Copy of Material Master_S112.xlsx]q_S112'!$G$2:$I$7, 2, FALSE)
Thank you for all your answers. It's kind of interesting but, I have to hit at first shift and then control not to get this error. It wasn't like that before but when I hit control first and then shift+down it gives the error. But at least it works like this.
if you use win 10 , you must change the regoin configoration .
in control panel > region >formats> additional setting> list separator
change content to ";"

Excel VLOOKUP #N/A

What I am trying to achieve is matching two projects with eachother "Project No" in two tables, and return the "project name" in second table. When I do this I receive this error inside the cell error #N/A.
I have formated both tables into number value, but this does not solve the problem.
Anyone that has an idea what I can do in order to solve this problem.
Here is the first table (just a snapshot to give an idea).
Here is the second table (just a snapshot to give an idea).
The #N/A error indicates that Excel cannot find the value you've specified in the list in which you've told it look. When I run into this, there are a few things I do to troubleshoot:
1) Make sure both columns are in the same format.
You mention you've already done this (good job!) but sometimes formatting gets stuck in Excel. One thing you can do is to highlight each range and use the text to columns feature (under the data tab) to convert it all to the same format. Another option is to copy the range into Notepad or some other plain text editor and then copy it back into Excel to strip out any lingering formatting.
2) Double check your ranges.
Make sure your Vlookup is looking to the correct range, and make sure that range is locked (i.e. $A$1:$D$100 rather than A1:D100), or else your ranges are going to slide around as you move drag the formula down your table. If the range refers explicitly to a table address (e.g. Table1[#All]), then make sure every data point if validly within that table.
3) Make sure the range lookup parameter is set to FALSE
Range lookup is the last parameter of the vlookup, and determines whether the vlookup will find an exact match (set range lookup to FALSE) or a partial match (set range lookup to TRUE). Setting range lookup to TRUE can sometimes create errors like the one you've described. I always set it to FALSE by default unless I need specifically need to set it to TRUE.
4) Use the find and replace window to manually evaluate the formula
If everything looks correct, copy the value you want to look up and paste it into the find and replace window to search for it. If Excel can't find it and you can see it in your list, something is definitely wrong with the formatting or else your file may have some degree of corruption. If Excel can find the value, double check that it is within the range your vlookup is looking through.
If fist table is the one with vlookup formula and second is a source it may mean that such Project No. doesn't exist in your source table. Did you check that possibility?

Change the file reference in a formula using the content of another cell

I need help with a formula (or macro) please.
On the printscreen below ColA and Row1 are copied in via a macro and cells c2 down and right are formulas.
The problem I have is when Row1 is copied in next time the project names might change (say a new one called "100 Project") and I will need to change the filename in the formulas in C5 onwards.
I don't want to use INDIRECT as I can't have 70 or so files open.
Is there a formula I can use please or does anyone have a macro that'll do the job?
Printscreen
Show us a full circle of what you want to use, what you want to do with it and what the end result should look like. (you can reference the screenshot provided) as I'm not quite clear of want you want to do and don't want to guess.
In any case:
=CELL("filename",A1) should help you with current file name however you rename the document you work on.
Other than that you can import however many filenames you have on a list without needing to open them. We will expand on that should it be needed.
PS Based on updated info:
=INDIRECT(CONCATENATE("'",$C$3,"'","!","A",ROW()))
The reference to make that formula work is C3
This is integrated instead of your
" 'g:\it\capex\2015 etc etc tec ... Plan'!$B$20:$B$119 "
C3="C:\folder\[filename.xlsx]sheet name"
(derived by formula or however you want - the result shows the address)
If you want to put in the sheet name independently or more flexibly simply add one more ,references for it to the concatenation.
Either adjust the formula to accommodate your C3 or adjust your c3 to accommodate the formula its fairly simple = you can do it more easily when you remove the INDIRECT and see what remains as text. Get the correct text running through that and you can need correct reference. You can use the general idea to create dynamic address lists that you can reference from 1 location. Further more vba can pull names from directories so you can compile an active list, leaving you with little to no manual work... Yes - most people usually frown upon crafting location addresses in formulas and usually tell you to reorganize your work files, but some times its necessary to access files ad-hoc on value based references.

Resources