Check Length of each cell in specific column - excel

I have an excel spreadsheet that is giving me an error for a specific column. It's a truncate error so i am needing to check each cell in column O for length >= 8000. The datatype is varchar(max) so by checking this i can see which row is being rejected. This error occurred when trying to import the data into SQL server. I need to find which row is causing the error and fix it so i can import the data. The error actually states its either a truncate exception or a invalid character so this method will at least solve one of the questions. The top row is the column names if that matters. I believe i need something like this LEN(Column O) >= 8000 but im not very excel savy so hopefully i can find help here :)

Create a new column in the raw data. Call it "Greater than 8000"
Put a formula in the next cell down (row 2 I assume). Then put this formula in there:
=IF(LEN(O2)>8000,"YES","NO")
copy and paste the formula to the last cell row.
Then apply a filter to the data (click on a1, then click Home-->Sort & Filter --> Filter). Then go to the new column "Greater than 8000" and filter for "YES".

LEN(InsertYourCellHere) will indeed give you the lenght of text inside the cell. What you can do is create a new rule in Conditional Formatting menu => Use a formula to determine which cells to format. There you will enter the LEN() formula.

Related

How to see if multiple columns match different conditions and return text

I'd like to return a "u" if the cell to the left is in column I on my other tab AND if the cell underneath is in column F on the other tab. How would I go about this please?
So far I have in cell f7: =IFERROR(IF(VLOOKUP(F8,Table!I:I,1,0)<>"","u",0),"")
but I need to also look in Table!F:F to see if the date from the cell underneath is in it.
EXAMPLE
Here is my data in tab 1:
Here is what I'm looking to do in tab 2:
If I understand your question correctly this formula should provide what you are looking for.
=IFERROR(IF(AND(VLOOKUP(F8,Table!I:I,1,0)=F8,VLOOKUP(F9,Table!F:F,1,0)=F9),"u",0),"")
Using the AND() function requires both tests to be TRUE in order for the evaluations to be TRUE. An OR() allows both to be checked but returns TRUE if either is TRUE. So using the AND() checks both conditions and returns "u" in your IF statement only if both are TRUE.
I changed the logical criteria to equals just to be sure the values match.
Hi Becca,
It seems the part that I missed in the first attempt was the across. I think the vlookup is your easiest way to do this, but you may have to rearrange your columns. If you cut the column I:I on the table tab, and highlight column F:F right click and insert cut cells this will line the data up better for the vlookup. Now if you use the below formula you can compare across.
=IFERROR(IF(VLOOKUP(F8,Table!F:G,2,0)=F9,"u",0),"")
What this does is it finds the look up value and returns the value from the other column. Then it compares the returned value to the value in the cell underneath. If they match you get a "u" and if not, you get a "0". If the lookup is an error, you receive a blank.
Ok let's try this. A $ turns a relative reference into an absolute reference. The following looks up the name in column "A" and returns the date in column "B". It then compares that date to the value of row 10 of the current column. If it is drug across columns it will update to that column. If you wish to lock the column and unlock the row simply move the $ to before the "B" for the "B10" reference.
=IFERROR(IF(VLOOKUP($A2,Table!$A:$B,2,FALSE)=B$10,"U",0),"")
[![enter image description here][3]][3]
If you only care that the date is in the list below you could use an HLOOKUP.
=IFERROR(IF(VLOOKUP($A2,Table!$A:$B,2,FALSE)=HLOOKUP($B2,$10:$10,1,FALSE),"U",0),"")
Then you will have to use an index match however, this will not work on Excel 2019 or older. You will most likely need to use Excel 365. It will work best if you are always checking against the same reference (say B10), but you can drag it across.
=IFERROR(IF(INDEX(Table!$B:$B,MATCH($A2&B$10,Table!$A:$A&Table!$B:$B,0))=B$10,"u",0),"")

Error in conditional formatting formula where the same formula works in a cell

I'm trying to conditionally format a column of cells based on whether the combination of two other columns appear in a Table.
Here is a link to the test workbook I am playing with and screenshots below for those that don't like clicking strangers links!
https://1drv.ms/x/s!Al1Kq21dFT1ij4ktFd0mzBniNX00tQ?e=L6aQm4
On the far left is an Excel table ([Table1]) that contains a list of valid combinations of [Category] and [Item]
Columns E&F contain some sample data to test against
Column G is the number of matching combinations I expect to return from a COUNTIFS() function
Column H is simply the same formula compared to 0 so I get a boolean result.
The actual formula to get the result shown in Column H is
=COUNTIFS(Table1[Category],"="&E4, Table1[Item],"="&F4)=0
All the above works as expected.
In Column J is just some literal text with conditional formatting. The condition is simply =H4, again this works as expected.
Now to the problem...
I want to avoid having the helper column (H) so I thought I could just use the same formula that I used in column H, as my condition formula.
So, I tried to use this in the conditional formatting formula dialog.
=COUNTIFS(Table1[Category],"="&E4, Table1[Item],"="&F4)=0
and with parantheses
=(COUNTIFS(Table1[Category],"="&E4, Table1[Item],"="&F4)=0)
Unfortunately, this results in the generic "There's a problem with this formula" error message.
If might be that there are some limitations with conditional formatting formulae that I'm not aware of (I'm no Excel guru, I'm a SQL developer really).
BTW: I need to stick with using a table as my real-world scenario is that there will be several tables, all populated from a database via a separate process with lengths varying from 2 or 3 entries to potentially thousands.
I would appreciate any help, even if it's just to say "You can't do this, you'll need to use your helper column..."
Thanks for looking...

Vlookup function doesn't return value

I used this VLookup formula to retrieve value from another sheet Sheet2 which contains a table with two columns NumEchelon, Indice:
=RECHERCHEV("1/1";Sheet2[NumEchelon];Sheet2[Indice];faux)
But it doesn't return any value, when i click on the cell i found just the formula not the value i want to retrieve from the sheet Sheet2.
Looks like you are using french version of Excel, so I will leave it up to you to find the translated commands. The basic problem from what I am gathering is you are looking up "1/1" in the named range NumEchelon. I am going to guess that this named range is 1 column wide. sheet2[Indice] is a separate chunk of data.
Vloopkup is supposed to search for a specified term in a table (usually 2 or more columns wide located to the right of the search column) and return a value in the same row as the found value in a specified column. The columns are numbered left to right with the first column being zero. The false or FAUX at the end tells it you want an exact match.
So without seeing your data I would say make sure that NumEchelon covers both columns of information, and INDICE column is to the right of NumEchelon. Where you have Sheet2 Indice replace with with a numeric value for the column its from the table you made for the vlookup.
So Assuming NumEchelon is A1:A8 and Indice is B1:B8 I would do the following:
Use a new named range "MonTableaux" and define it as sheet2!A1:B8
=VLOOKUP("1/1",MonTableaux,2,0)
Without the named range it would look like
=VLOOKUP("1/1",sheet2!$A$1:$B$8,2,0)
'note the 0 is the same as false
Now you may be using TABLES and I am not all that familiar with table so there may be short cuts. If that is the case someone point it out to me and I will delete my answer.
If your information you want to return in not lined up vertically with the information you are searching for or if the information you want to return is located to the left of what you are searching for you will want to use a combination of INDEX and MATCH. maybe something like this:
=INDEX(sheet2[Indice],match("1/1",sheet2[NumEchelon],0))
If the formula is showing up in the cell, and not a result like #N/A then the cell is likely formatted as Text, change it to General and click in the formula bar and hit enter again to show the formula result instead of the formula text.

How do I override excel conditional formating if one cell contains a value

I currently have a worksheet where column C changes to red if it is due in the next seven days. I would like to have the row change to a different format if I enter ANY date in column E. I have tried a bunch of different ways but I can only get the E cells to change or the entire worksheet and it seems to ignore the E entry.
Here is a link to the file:
http://mpereaseportfolio.weebly.com/uploads/2/5/6/2/25627115/summer_assingment_schedule.xlsx
Try this:
Select the whole range of data except headers, i.e. A2:H193
Now apply a new condition in conditional formatting using the formula
=$E2<>""
Select required format
Make sure that condition is at the top and tick "Stop if TRUE" so that other conditions are not applied
Note that you need exactly that formula including the $
Note also that the formula always refers to the first row of data but will work for the whole range
Please try a formula rule such as:
=(IFERROR(FIND(" AM",$E2),FIND(" PM",$E2))>0)
with applies to =$A$2:$H$200 or similar

Simple VlookUp on MS Excel not working

I am trying to use VLookUp from MS Excel 2010 for the data below:
Basically I want to update the Value of CostA by the Value given in Cost by using the Job Ref but ends up #NA
The formula I paste in cell B4: =VLOOKUP(A4,E3:F4,5,FALSE)
NOTE: The Column A Job Ref is a link but even when I remove the hyperlink the same problem occurs. I have attached the Excel file.
Excel file
The Job Ref number is stored as text. Select cell A4 and (a) click the drop down and select "Convert to Number" or (b) go to edit mode by hitting F2 then press Enter.
Also, your VLOOKUP reference is outside your table. Change 5 to 2.
=vlookup(A4,$E$3:$F$4,2,false)
The $ signs fix the range that your formula is looking in. When your doing more lookups (e.g. have more job references in cells A5, A6 etc), you can just paste the formula down (don't forgot to extend your range).
The 2 means when finding that job ref, return the result from the second column of your data set, with your data set being E3:F4. Because in your initial formula that was a 5, the vlookup was finding the job ref, then it's trying to return the 5th column, but E3:F4 is obviously only 2 columns so it'll return an error.
Hopefully this helps.

Resources