So here is a news from strange but true department. Microsoft Excel blamed for gene study errors [bbc.com].
Microsoft’s Excel has been blamed for errors in academic papers on genomics.
Researchers trying to raise awareness of the issue claim that the spreadsheet software automatically converts the names of certain genes into dates.
Gene symbols like SEPT2 (Septin 2) were found to be altered to “September 2”.
Aah, classic!
This is what happens when you spend countless hours learning genome sequencing and very little about the software tools where your data goes. May be we need bring clippy back to warn people about such sticky situations.

All jokes aside, here is a public service announcement for you. Beware of helpful features in Excel like auto correct, flash fill, auto fill, scientific notation etc.
Here are a few tips for you if you find yourself coding genome in Excel (or something similar)
- Use TEXT format for data that contains possible dates, values that start with = etc. To set TEXT format, select data entry range and use Home > Number > Text
- This can deal with cells that contain possible dates, credit card numbers, very long numbers, leading zeros, fractions, values that start with = (which Excel thinks formulas )

- This can deal with cells that contain possible dates, credit card numbers, very long numbers, leading zeros, fractions, values that start with = (which Excel thinks formulas )
- When importing text files to Excel (like your genome sequence data or what have you), select text as data type for the columns that can be misinterpreted by Excel.

- If a cell starts with = and should not be treated as a formula, prefix the cell with ‘ apostrophe
- Disable features like Flash fill, auto complete and percentage entry if you must

Help the hapless, share your tips
Now its your turn. Please share your tips to handle situations like these. Post your tips in the comments box.
More reading:
Before you embark on saving sensitive stuff in spreadsheets, soak up some survival skills:

















6 Responses to “Make VBA String Comparisons Case In-sensitive [Quick Tip]”
Another way to test if Target.Value equal a string constant without regard to letter casing is to use the StrCmp function...
If StrComp("yes", Target.Value, vbTextCompare) = 0 Then
' Do something
End If
That's a cool way to compare. i just converted my values to strings and used the above code to compare. worked nicely
Thanks!
In case that option just needs to be used for a single comparison, you could use
If InStr(1, "yes", Target.Value, vbTextCompare) Then
'do something
End If
as well.
Nice tip, thanks! I never even thought to think there might be an easier way.
Regarding Chronology of VB in general, the Option Compare pragma appears at the very beginning of VB, way before classes and objects arrive (with VB6 - around 2000).
Today StrComp() and InStr() function offers a more local way to compare, fully object, thus more consistent with object programming (even if VB is still interpreted).
My only question here is : "what if you want to binary compare locally with re-entering functions or concurrency (with events) ?". This will lead to a real nightmare and probably a big nasty mess to debug.
By the way, congrats for you Millions/month visits 🙂
This is nice article.
I used these examples to help my understanding. Even Instr is similar to Find but it can be case sensitive and also case insensitive.
Hope the examples below help.
Public Sub CaseSensitive2()
If InStr(1, "Look in this string", "look", vbBinaryCompare) = 0 Then
MsgBox "woops, no match"
Else
MsgBox "at least one match"
End If
End Sub
Public Sub CaseSensitive()
If InStr("Look in this string", "look") = 0 Then
MsgBox "woops, no match"
Else
MsgBox "at least one match"
End If
End Sub
Public Sub NotCaseSensitive()
'doing alot of case insensitive searching and whatnot, you can put Option Compare Text
If InStr(1, "Look in this string", "look", vbTextCompare) = 0 Then
MsgBox "woops, no match"
Else
MsgBox "at least one match"
End If
End Sub