I have two excel sheets in a document used to make charts from number estimates. One sheet is a database query via plugin that imports data into excel. When pulling the data from my database, you can see the plugin correctly does not populate blanks with a 0 in columns C and D.
RallyQuery
The 2nd sheet is used to perform calculations in order to make the charts. If you look closely, columns G and H should exactly match C and D from the previous picture, however, excel has added zeros in cells that were blank in the database. The formula used to pull the data from the first sheet is:
=IFERROR(AgileCentralQueryResultList[#PlanEstimate],"")
I need excel to stop replacing blanks with zeros without removing any true zeros that were correct in the database. All of the answers I've found also remove the true zeros, which will not work.
Totals
You need to adjust your formula a little bit, A blank cell apparently is not going to produce an error. so you may want to drop the iferror part of your formula and go with an if. If you have source cells that contain actual error results then you will need to do a second if.
Option 1
=IF(AgileCentralQueryResultList[#PlanEstimate]="","",AgileCentralQueryResultList[#PlanEstimate])
Option 2
=IF(OR(AgileCentralQueryResultList[#PlanEstimate]="",ISERROR(AgileCentralQueryResultList[#PlanEstimate])),"",AgileCentralQueryResultList[#PlanEstimate])
Option 3
=IFERROR(IF(AgileCentralQueryResultList[#PlanEstimate]="","",AgileCentralQueryResultList[#PlanEstimate]),"")
I would try option 1 first and see if you need to take that extra step for error checking using option 2.
Using all the great changes from "Forward Ed" I was able to add my IFERROR check back to his formula to get it all to be happy again. Thanks a ton Ed, credit goes to you for guiding me.
=IFERROR(IF(OR(AgileCentralQueryResultList[#PlanEstimate]="",ISERROR(AgileCentralQueryResultList[#PlanEstimate])),"",AgileCentralQueryResultList[#PlanEstimate]),"")
Related
I am trying to join different lists that have less than 3 values on it, there is an example
.
I was able to do it using macros, but I wanted something more automated because these lists updated quite often, is there a way of doing something like that just by using formulas? If no, is there a way of doing it using VBA but in a better way than "clicking" buttons?
Answering VBasic2008:
I am new to this intermediary/advanced excel functions. I just realized that my Macro didn't work. It does not matter where the results will be, could just be at the end of the table. I have around 20 columns.
Basically, I tried to make something that checks if the number of values in the column is below 3 and if it is it would take this list and paste on the "Group X", but I am trying to use just functions to do that, I was able to make a list with all the columns using INDEX + MOD, but it took all of the names, from AAA to the last one, and I wanted something that would take just the list with less than 3 values.
Some update:
=INDEX(IF($F$11:$J$11=3;$F$6:$J$9;"");MOD(ROW()-ROW($O$6);4)+1;INT((ROW()-ROW($O$6))/4)+1)
I was able to come up with this formula, but everything appears with some spaces.
Thanks,
Matheus
Doing this with formulas is possible, but quite advanced. Someone here will write a formula for you which you may not be able to maintain when your scenario changes.
If you already have VBA code that does what you need doing, then you can move that code to an event procedure that starts automatically when a new value is added to the columns.
The event you need is the Worksheet_Change event and it lives in the Sheet module (right-click the sheet and click "View Code". That will show the Sheet module.
In your scenario, you want to run the code when a value is changed in columns D to G, so your code must start with something like
Private Sub Worksheet_Change(ByVal Target As Range)
' run only when a value in columns D to G are changed
If Not Intersect(Target, Range("D:G")) Is Nothing Then
' your code goes here
MsgBox "You just changed a value in one of the the watched columns!"
End If
End Sub
Edit after additional requirements
If you have Office 365 with the new Dynamic Array functions, this formula approach will work.
Building on your index formula, I made a small change. You can use the modified index formula in a helper column. Then use the Filter() function on the values returned by the Index formulas.
Index formula in cell J4 and copied down to J23
=INDEX(IF($D$11:$H$11=3,$D$4:$H$7,"#"),MOD(ROW()-ROW($J$4),4)+1,INT((ROW()-ROW($J$4))/4)+1)
Filter formula in K4
=FILTER(J4:J23,(J4:J23<>"#")*(J4:J23<>0))
If I understand you correctly, try the following:
I put the formula to count the number of entries in row 2, to make it easier to add items below.
I assumed you mean three or less; and not less than three.
If you have Windows O365, you can use the following formulas: (and change the 100 to the lowest possible row)
D2: =COUNTA(D$4:D$100)
and fill right for the number of columns
I4: =FILTERXML("<t><s>" & TEXTJOIN("</s><s>",TRUE,FILTER($D$4:$G$100,$D$2:$G$2<=3)) &"</s></t>","//s")
I need help with the below formula. I already tried to find a solution for this problem but no success.
If account number exists in column A in the 'Returns' tab and also in column A in the 'July Sales' tab, then I need to get date from the column B in 'Returns' tab.
I manually checked a few accounts on both spreadsheet and find some duplicates.
My formula is as follows:
=VLOOKUP(Returns!A:B,A:B,2,0)
Screenshots:
I tried to change format to text/general, text to columns and trim function but it's still not working.
Also, as I have over 200k rows in each table, can I use any different formula instead to speed this up?
Finally, is there any way to pick dates only if these are within 30 days
Thanks in advance.
You're using Returns!A:B as your lookup value, which doesn't make sense. Instead, try the following:
=VLOOKUP([#Account], tblReturns[[Account]:[Submit_Date]],2,FALSE)
where tblReturns is the name of the table on your Returns worksheet.
I've made the assumption that you're working with tables, since the data in your screenshots is formatted like the default table. If they're just normal ranges, the equivalent is
=VLOOKUP($A2,Returns!$A:$B,2,FALSE)
=IF(COUNTIF(RETURNS!A:A,A2)>0,B2,"NO RETURN INFO")
Not sure what you want done when the account is not found on the RETURNS worksheet. Change "NO RETURN INFO" to what ever text you want including "" for a blank. Make sure you apply the same format for cells in column F as you do in column B. Copy the above formula down as required.
try the below, which will return blanks for non-matches as opposed to errors;
=IFERROR(VLOOKUP($A2,Returns!$A:$B,2,FALSE),"")
I highly recommend an INDEX/MATCH combination over a VLOOKUP. It is MUCH faster, particularly if you are working with a large number of rows. It may even be faster than the COUNTIF solution suggested by #ForwardEd.
=IFERROR(INDEX(Returns!$B:$B,MATCH($A2,Returns!$A:$A,0)),"")
I get an excel data feed file from an outside source on vendor information. I copy and paste-values into my own XLSM and run some VBA scripts on the data. In short, the script aggregates data removing duplicate rows leaving one list of unique vendor numbers in column A with the aggregated data for each vendor. Then the script uploads the data into an SQL database for other departments.
Yesterday while uploading, my database spit an error claiming an INSERT attempt with a duplicate value where dupes are not allowed. Strange... I went back to the excel data and sorted on vendor number to discover that there are tons of duplicate rows. What? This never happened before.
I highlighted the sorted column A and copied it off to another sheet, then used the Remove Duplicates tool. Excel reported that there are no duplicates when I'm literally staring at easily 10 cases of duplicate vendor numbers. Unfortunately, this is a TEXT column because other vendor numbers have letters in them like AX6058
The top two cells A1 and A2 are showing vendor number 7003 and 7003. As a test, when I say =A1=A2 the test returns FALSE.
I made sure both cells were TEXT... =A1=A2 still returns FALSE
I changed both cells to GENERAL... =A1=A2 still returns FALSE
I TRIM()'ed both cells for spaces... =A1=A2 still returns FALSE
I tested the LEN() of both cells... they are both 4
I forced both cells to be NUMBER with no decimals and =A1=A2 is still FALSE!!
If I add 1 to 7003 = 7004, then subtract 1 to get back to 7003 for both cells, then =A1=A2 finally returns TRUE after the math manipulation.
So now my VBA script has to segregate on textual vendor numbers that are truly numeric and conduct this goofy math work to ensure that the duplicate vendor number are TRUE-ly equal so they can be aggregated.
Has anyone seen this before? Or have some funky trick or setting so I don't have to do the goofy +1 / -1 math in my script?
As I said, I am xlPastingValues:
'copy vendor ID (in column 6)
ActiveSheet.Columns(6).Copy
Sheets("Tempcopy").Columns(1).PasteSpecial xlPasteValues
Thanks,
John
EDIT: My Excel is 2010, but I don't know the version used to provide the source data.
Using #BrakNicku comments, I added an interim sheet that forces the correct data types, then copies into the worksheet for processing.
I've been struggling with this longer than I care to admit, but I have a fairly simple OFFSET function call which works on one sheet, but if I copy it to a different sheet it gives a #VALUE error.
On a sheet named "Deliverable" I have this formula in a cell:
=OFFSET(Deliverable!$B$72,1,0,,3)
and it works fine.
If I go to any other sheet and use the same exact formula, or use it in the Name Manager, it gives a #VALUE error.
If I leave off the final parameter indicated the number of columns I want, it does work:
=OFFSET(Deliverable!$B$72,1,0)
but of course isn't giving me the range I need.
Any idea what's going on with this?
I'm using Excel 2016 on Windows 7.
-- Updated Info --
In a nutshell, my spreadsheet has two cells which I'm using as dropdown lists, where the 2nd cell's list feeds off the selection in the first. The data they are based on has this format:
OptionA A B C D
OptionB A B
OptionC D E F
So the first dropdown uses a simple Data Validation source pointing to the column with OptionA, OptionB, etc. Once that's chosen, the second dropdown list should contain the appropriate options for the one selected. So if OptionB is selected, then the 2nd dropdown list should show A and B.
When I initially wrote this, the data validation source was just a simple VLOOKUP entry, but the lists often had blanks since the number of options varies for each entry. Wanting to fix it up a bit, I ended up with this formula:
=OFFSET(Deliverable!B72,Deliverable!B87,0,1,COUNTA(OFFSET(Deliverable!B72,Deliverable!B87,0,1,5)))
There won't be any more than 5 options, and there are no empty cells in the middle of the data to filter out.
In one spreadsheet I have I used this as a named range definition, then specified the named range for the cells data validation source and it worked. In this other spreadsheet however, it gave me the error described earlier.
However, it looks like when I enter the statement directly into the data validation source field and not in the name manager, it works as expected.
Am I taking the totally wrong approach?
What is it that you want this formula to do? As written, it is returning a block of three horizontal cells. The #VALUE error is Excel's way of telling you "Hey, you're trying to return three cells, but I can't fit them all in the one cell that you are calling this formula from".
The reason you see a result in some places and not others is because of something called Implicit Intersection. Give it a spin on Google. But basically, it just returns whichever one of those three results corresponds to the column that the formula is entered into. If you copy that exact same formula to say row F you will see that it returns a #VALUE error there, because it doesn't know what cell it should return given the column you're calling it from doesn't match any of the cells it is returning. The fact that you don't know this indicates that the formula you're using doesn't in fact do what you think it does.
--UPDATE --
Okay, following your further clarificaiton it seems that you're talking about Cascading Dropdowns aka Dynamic Dropdowns. Lots of info on Google about how to set these up, but you may be interested in an approach I blogged about sometime back that not only provides this functionality, but also ensures that someone can't later on go and change the 'upstream' dropdown without first clearing the 'downstream' one should they want to make a change.
Note that those links talk about a slightly complicated method compared to others, but the method has it's advantages in that it also handles more levels than two, and your DV lists are easily maintained as they live in an Excel Table.
This sounds like an array equation. Try hitting Ctrl+Shift+Enter in the other sheets to validate it as an array equation.
Whenever you need to reference ranges instead of single cells, Excel needs to know that you are working with arrays.
I have a spreadsheet where Iam trying to add the serial numbers in each row using the below formula
=IF(C149<>"";MAX($B$149:OFFSET(B150;-1;0))+0.1;"")
However, whenever I delete the rows in B column there will be error value in all other rows like #N/A
Whether it is possible to delete the rows without affecting the Formula ?
I heard there is a excel function "INDEX" to be used, please reply with your answers how to apply INDEX function to the above Formula
Not exactly the answer you were asking for, but google picks this out for deleting without breaking formaulas - so anyone landing here from google...
The formulas break because you are removing cells from the spreadsheet - chainging the structure of the sheet. Where as what you want to do is just remove the data, and have all the remaining data move up.
One way is to select all the data below the line you want cleared (plus one blank line at the end) - then copy that range (to the clipboard) and paste it all back in one row higher.
Not a great solution - but it works - I found this question looking for a better way! :)
The issue could be related to $B$149 When you delete a row the $ means that the 149 cannot change accordingly like the C149 and B150 would , this may then mean that it is pointing to incorrect data after the deletion.