BatMan22 Posted November 18, 2017 Share Posted November 18, 2017 (edited) Why doesn't my first if statement below work? The rest work great. Can you not use "&" in a if statement? Is there a work around for that? expandcollapse popupGlobal $ColumnC[5] Global $ColumnB[5] Global $testcodeIC1="300.1" Global $testcodeIC2="218.6" Global $testcodeIC3="poop" $ColumnC[0] = "300.1" $ColumnC[1] = "300.0" $ColumnC[2] = "poop" $ColumnC[3] = "zomgnewtestcode" $ColumnC[4] = "300.1" $ColumnB[0] = "Sample1" $ColumnB[2] = "Sample2" $ColumnB[3] = "Sample3" $ColumnB[4] = "Sample4" $ColumnB[4] = "Sample5" For $i = 0 To UBound($ColumnC) - 1 ;should write zomgnewtestcode to the unknown file, eventually this will prompt me to assign it to IC1, 2, or 3. But for now I just want to debug why the IF statement isn't working. If $ColumnC[$i] <> $testcodeIC1 & $ColumnC[$i] <> $testcodeIC2 & $ColumnC[$i] <> $testcodeIC3 Then FileWrite(@ScriptDir & "\ICUNKNOWN.txt", $ColumnB[$i] & " " & $ColumnC[$i] & @CRLF) EndIf Next For $i = 0 To UBound($ColumnC) - 1 If $ColumnC[$i] = $testcodeIC1 Then FileWrite(@ScriptDir & "\IC1.txt", $ColumnB[$i] & " " & $ColumnC[$i] & @CRLF) EndIf Next For $i = 0 To UBound($ColumnC) - 1 If $ColumnC[$i] = $testcodeIC2 Then FileWrite(@ScriptDir & "\IC2.txt", $ColumnB[$i] & " " & $ColumnC[$i] & @CRLF) EndIf Next For $i = 0 To UBound($ColumnC) - 1 If $ColumnC[$i] = $testcodeIC3 Then FileWrite(@ScriptDir & "\IC3.txt", $ColumnB[$i] & " " & $ColumnC[$i] & @CRLF) EndIf Next Edited November 18, 2017 by BatMan22 Link to comment Share on other sites More sharing options...
BatMan22 Posted November 18, 2017 Author Share Posted November 18, 2017 Ummm to answer my own question.. apparently you can use AND but not "&" ? Even though you can use & everywhere else? I'm sooooo confused... Link to comment Share on other sites More sharing options...
water Posted November 18, 2017 Share Posted November 18, 2017 & is a string concatenator according to the help file. My UDFs and Tutorials: Spoiler UDFs:Active Directory (NEW 2022-02-19 - Version 1.6.1.0) - Download - General Help & Support - Example Scripts - WikiExcelChart (2017-07-21 - Version 0.4.0.1) - Download - General Help & Support - Example ScriptsOutlookEX (2021-11-16 - Version 1.7.0.0) - Download - General Help & Support - Example Scripts - WikiOutlookEX_GUI (2021-04-13 - Version 1.4.0.0) - DownloadOutlook Tools (2019-07-22 - Version 0.6.0.0) - Download - General Help & Support - WikiPowerPoint (2021-08-31 - Version 1.5.0.0) - Download - General Help & Support - Example Scripts - WikiTask Scheduler (NEW 2022-07-28 - Version 1.6.0.1) - Download - General Help & Support - Wiki Standard UDFs:Excel - Example Scripts - WikiWord - Wiki Tutorials:ADO - WikiWebDriver - Wiki Link to comment Share on other sites More sharing options...
Joboy2k Posted November 18, 2017 Share Posted November 18, 2017 If ($ColumnC[$i] <> $testcodeIC1) AND ($ColumnC[$i] <> $testcodeIC2) AND ($ColumnC[$i] <> $testcodeIC3) Then FileWrite(@ScriptDir & "\ICUNKNOWN.txt", $ColumnB[$i] & " " & $ColumnC[$i] & @CRLF) EndIf Link to comment Share on other sites More sharing options...
Recommended Posts
Create an account or sign in to comment
You need to be a member in order to leave a comment
Create an account
Sign up for a new account in our community. It's easy!
Register a new accountSign in
Already have an account? Sign in here.
Sign In Now