IP address field validation - sharepoint

I'm trying to validate an IP address column in SharePoint 2010 with the following formula. I get an error telling me there's a syntax error without anymore details. Knowing it works in Excel; any idea what's wrong with this formula?
=AND((LEN(Address)-LEN(SUBSTITUTE(Address;".";"")))=3;ISNUMBER(SUBSTITUTE(SUBSTITUTE(Address;":";"");".";"")+0))

Here's a working formula for SharePoint 2013 Online, where IP is the name of the column containing the IP address. Note that there are 40 references to the column name, if you use a long column name to could reach the character limit on validation formulas (I originally had IP Address, which was 320 characters longer, also why I used FIND instead of SEARCH)
=IF(AND(AND(VALUE(LEFT([IP],FIND(".",[IP])))>=0,VALUE(LEFT([IP],FIND(".",[IP])))<256),AND(VALUE(MID([IP],FIND(".",[IP])+1,FIND(".",[IP],FIND(".",[IP])+1)-FIND(".",[IP])))>=0,VALUE(MID([IP],FIND(".",[IP])+1,FIND(".",[IP],FIND(".",[IP])+1)-FIND(".",[IP])))<256),AND(VALUE(MID([IP],FIND(".",[IP],FIND(".",[IP])+1)+1,FIND(".",[IP],FIND(".",[IP],FIND(".",[IP])+1)+1)-FIND(".",[IP],FIND(".",[IP])+1)))>=0,VALUE(MID([IP],FIND(".",[IP],FIND(".",[IP])+1)+1,FIND(".",[IP],FIND(".",[IP],FIND(".",[IP])+1)+1)-FIND(".",[IP],FIND(".",[IP])+1)))<256),AND(VALUE(RIGHT([IP],LEN([IP])-FIND(".",[IP],FIND(".",[IP],FIND(".",[IP])+1)+1)))>=0,VALUE(RIGHT([IP],LEN([IP])-FIND(".",[IP],FIND(".",[IP],FIND(".",[IP])+1)+1)))<256)),TRUE,FALSE)

The answer reside in the fact that there are multiple limitations to SharePoint field validation by formula. Although it uses the same syntax as Excel, its far from being as versatile as Excel is. Here's the well hidden reference that list available functions for field validation.
The problem in the previous question is that SUBSTITUTE() and ISNUMBER() aren't available.
A proper way to validate an IP address would be using a combination of FIND() and MID() instead.

The ISNUMBER function works, it is even mentioned in your link:
To check if a column value or a part of it matches specific text, use the IF, FIND, SEARCH, and ISNUMBER functions.
I did need to add +0 after my column name as mentioned here.
Edit:
After further testing I have discovered that this solution allows for entries with spaces in so it is not ideal.

Related

How to count cells in a table column that contains a specific text string (COUNT.IF doesn't work)

I need to count how many cells in a table column that contains a specific text string. I'm using this formula and it works well:
=COUNT.IF(TB_table_name[col_name];"*string_to_be_found*")
But I need to count only filtered cells.
I've found may solutions (using SUMPRODUCT) on internet, but only to common cells and not table conlumns.
This is the kind of table that I have:
As you can see, there are many values in the same cell (It happens because it is generated automatically by a survey made in MS Forms). Because of this, I need to search for a specific string to be counted.
Using "COUNT.IF" I have this results:
Please observe that the values in the cell are not random, but predefined - of course the sequence could not be the same, but the list of possible terms are.
Please, can you help me figure this out? Belive me, I have tried many things but nothing worked and it seems to be a thing so easy to achieve :(
The trick is to combine a couple of the ideas you found using SUMPRODUCT.
You likely found this reference (or one just like it) that gave guidance for a formula like this:
=SUMPRODUCT(SUBTOTAL(3,OFFSET(B2:B7,ROW(B2:B7)-MIN(ROW(B2:B7)),,1))*(B2:B7="Quality"))
Which translates to your problem-space like this:
=SUMPRODUCT(SUBTOTAL(3,OFFSET(TB_table_name[col_name],ROW(TB_table_name[col_name])-MIN(ROW(TB_table_name[col_name])),,1))*(TB_table_name[col_name]="*string_to_be_found*"))
This works perfectly fine if you're NOT using a wildcard search. But that's what you need. So in this answer it shows that the wildcard in a SUMPRODUCT needs to use the -- operator. So the result is to combine the two answers and you get:
=SUMPRODUCT(SUBTOTAL(3,OFFSET(TB_table_name[col_name],ROW(TB_table_name[col_name])-MIN(ROW(TB_table_name[col_name])),,1))*(--(ISNUMBER(FIND("string_to_be_found",TB_table_name[col_name])))))
Notice that the string_to_be_found does NOT have wildcard * specifiers. That's taken care of by the FIND function.

Excel: Formula can not be entered because level of nesting used more than allowed?

I am trying to put together this formula, but excel for some reason is saying that it can not be entered because the level of nesting used is more than what is allowed. can someone please show me where I am going wrong and how I could re-arrange this formula to get it to work. thanks
=IFERROR(IF((TODAY()-BC11)>6,IF(COUNT(SEARCH({"XWS","XWW","XWO","XVV","XVS","XVO","XVH","XTO","XTA","XSW","XSV","XST","XSS","XSS","XSR","XSP","XSL","XSJ","XSH","XSG","XSF","XSE","XSD","XSC","XSB","XSA","XS5","XS2","XPO","XMO","XMF","XLS","XLP","XLO","XLL","XLB","XKT","XKR","XKO","XKH","XKE","XKD","XJS","XHO","XHL","XHF","XHA","XGO","XFT","XFO","XFC","XFA","XDO","XBS","XBO","XAO","WHO","PSO","PRO","PRM","PRE","PPT","PLO","PGW","PGV","PGT","PGS","PGR","PGP","PGH","PGF","PGE","PGB","PGA","PFP","PDC","PDB","PCP","PBO","OFD","MWW","MWC","MTT","MSP","MSO","MRM","MPP","MPO","MPF","MNO","MMW","MMS","MMP","MMI","MLO","MJO","MHH","MGO","MFO","MEE","MEB","MDO","MCO","MAT"},G23)),HYPERLINK("\\UKSH000-FILE06\Purchasing\New_Supplier_Set_Ups_&_Audits\assets\EMAIL_PLANT2.msg","Action"),
IF(COUNT(SEARCH({"XCT","XCO","XCA"},G23)),HYPERLINK("\\UKSH000-FILE06\Purchasing\New_Supplier_Set_Ups_&_Audits\assets\EMAIL_CRANE2.msg","Action"),
IF(COUNT(SEARCH({"XJO","XJS"},G23)),HYPERLINK("\\UKSH000-FILE06\Purchasing\New_Supplier_Set_Ups_&_Audits\assets\EMAIL_OPERATOR2.msg","Action"),
IF(COUNT(SEARCH({"LTV","LTH","LSW","LMC"},G23)),HYPERLINK("\\UKSH000-FILE06\Purchasing\New_Supplier_Set_Ups_&_Audits\assets\EMAIL_3PL2.msg","Action"),
IF(COUNT(SEARCH({"UUU","KKK","PPP","ACO","ARC","BCO","BCP","BFA","BFI","BFL","BFP","BHO","BPO","BSO","BTF","BTH","BTO","BTP","CMA","CME","CMF","CMH","CML","CMN","CMP","CMZ","DHA","EAA","EAP","ECC","ECC","ECE","EPM","EPO","FPA","FPB","FPC","FPD","FPE","FPF","FPH","FPI","FPJ","FPL","FPM","FPN","FPO","FPP","FPR","FPS","FPV","FPW","FSC","FUE","FUG","FUW","FWC","FWG","FWH","HPO","ICH","ICM","ICN","ICS","ITL","ITM","QMO","RSS","RTT","SFG","SLB","SLC","SLR","SLT","SMA","SMC","SMM","SMP","SMR","SSF","SSG","SSV","STA","STO","UEO","UGO","UWO","ZFO"},G23)),HYPERLINK("\\UKSH000-FILE06\Purchasing\New_Supplier_Set_Ups_&_Audits\assets\EMAIL_PLANT2.msg","Action"), IF(COUNT(SEARCH({"BRL","BRP","BRS"},G23)),HYPERLINK("\\UKSH000-FILE06\Purchasing\New_Supplier_Set_Ups_&_Audits\assets\EMAIL_2.msg","Action"),
"")))))),"No Action Needed"), "")
Excel does not allow indefinite nesting of functions (64 nested functions is the limit - see http://office.microsoft.com/en-001/excel-help/nest-a-function-within-a-function-HA102809712.aspx), hence the error. I'd strongly suggest to use some helper cells or a VLOOKUP of your three-character codes and associated e-mail message texts.

Excel FIND function is not acting as expected, giving false negatives

I have two Excel sheets, and each one has a column with e-mail addresses in them. I am trying to write a formula that checks one sheet to see if that e-mail address is already located there. If so, it returns "Yes". If not, it returns "No". This is the formula I am using.
=IF(ISERROR(FIND(F2,'Group Contacts 2014'!F:F)),"No",IF(F2<>"","Yes","No"))
F2 is the e-mail address I am checking, and 'Group Contacts 2014'!F:F is the column of e-mail addresses I am checking it against in the other sheet.
This formula is currently returning false negatives. For example, I have an e-mail address in both sheets but it is returning "No" for it. Any ideas on what is going awry?
According to this documentation FIND locates a substring within a larger string. So it's not really a good choice when you want to search multiple cells.
FIND(find_text, within_text, [start_num])
I think you are looking for MATCH, which looks to see if a specified value appears in a particular range. Note that you probably want to specify match_type = 0 in order to force the function to only accept exact matches.
MATCH(lookup_value, lookup_array, [match_type])

Looking for an Excel formula combining VLOOKUP and SEARCH functions

I have a spreadsheet I am using for real estate where I want to be able to populate the name of a building based on an apartment's address. I need to create a formula that searches for certain information on a cell (probably the building number) and, based on that, looks at a table with building numbers and corresponding names and returns the appropriate value. I can't use a simple VLOOKUP based on the full address because, since they all contain apartment numbers, every address is unique.
I though about combining the search function with LOOKUP but that is not working for me so far.
Any thoughts on how to accomplish this?
Please try:
=VLOOKUP(VALUE(LEFT(D4,FIND(" ",D4)-1)),W:X,2,0)
copied down to suit.
Good point spotted by #Jerry:
=VLOOKUP(VALUE(LEFT(TRIM(D8),FIND(" ",D8,2)-1)),W:X,2,0)
(though any leading space is not necessarily going to be removed by TRIM).

How to use vlookup?

How to use Vlookup if the data that we want to match (col_index_num) contains a formula?
I want to match the vendor name to get the addresses. But the addresses contain Proper formula because I changed the address from all UPPERCASE to Proper. I thought that might be the problem why I get #N/A result.
For vlookup , make sure the field that you are trying to look up and the source table in which you are looking up the field are in same format (Vendor name. vlooking up numbers with text format creates error most of the time)
Also, there might be possibility hat there is really no match of the values that you are looking up . (may contain space)

Resources