Locate number string in Excel array? - excel

I have an array of numbers in Excel beginning in B2 as follows:
CA.CAD.CP.0.0.0.0.1.CY
CA.CAD.CP.0.0.0.0.2.CY
CA.CAD.CP.0.0.0.1.0.CY
CA.CAD.CP.0.0.0.2.0.CY
CA.CAD.CP.0.0.3.0.0.CY
CA.CAD.CP.0.0.0.6.0.CY
CA.CAD.OIS.0.0.0.1.0.CY
CA.CAD.OIS.0.0.0.2.0.CY
CA.CAD.OIS.0.0.0.3.0.CY
CA.CAD.OIS.0.0.6.0.0.CY
CA.CAD.OIS.0.0.0.9.0.CY
CA.CAD.OIS.1.0.0.0.0.CY
CA.CAD.ONT.0.0.0.1.0.CY
CA.CAD.ONT.0.0.0.2.0.CY
CA.CAD.ONT.0.0.0.3.0.CY
CA.CAD.ONT.0.0.6.0.0.CY
CA.CAD.ONT.1.0.0.0.0.CY
for several thousand rows. All of them follow this exact format. The numbers represent a date format; D.W.F.M.Y. So 0.0.0.5.0 means 5 months, for example.
I want to find all instances where the date value is "F", meaning all instances of "xx.xxx.xxx.0.0.x.0.0".
What is the best way to do this? I have tried using the FIND function but I think there might be a better way to search for this string.

This will return True/False based on whether the middle, or "F" position is anything but 0 or not:
=--MID(SUBSTITUTE(B2,".",REPT(" ",99)),5*99,99)<>0

With data starting in A2, in B2 enter:
=TRIM(MID(SUBSTITUTE($A2,".",REPT(" ",999)),COLUMNS($A:A)*999-998,999))
and copy across and then down:
Then set an AutoFilter on column G to display non-zero values.

Have you thought to use Word's Find feature? I understand it's in excel - but copy and paste data into Word - it's Find capabilities allow you to search for variables even formatting and special characters including tabs, and punctuation - you can use the Find/Replace feature to have it perform some special maneuvers to mark your text before simply copy/paste special back into excel when finished with Word's special unique features - it's find/replace capabilities are stronger than any other Office program

Related

Excel: compare two cells containing strings and return TRUE if multiple words match

I am trying to compare two cells containing strings. I can't use VBA for restrictive reasons on my computer so it's just formulas for me. This is what I have:
One cell is there to enter lots of text to explain a problem statement. Another cell is nearby containing a handful of keywords - may or may not be separated by commas (depending on what works!). So an example...
The product keyword cell might have: Camera, torch, messenger, internet
In the problem description cell I might write: "I am after a phone that can take good pictures with a 50mp camera and I can use the internet to look at the news"
The solution I'm after...In another cell I want to return the value of TRUE, if even one or more than one word matches - I don't need to know how many matches there were, just if there was a match somewhere and return TRUE.
You're asking essentially for an OR condition. From there just a couple lookup functions. Find will search case sensative, while Search will not.
Depending on your version of excel, you could use this for a dynamic solution with B2 being your sentance and B3 being your list of words separated by a comma (make sure spaces arent an issue).
=OR(ISNUMBER(SEARCH(TEXTSPLIT(B3,","),B2)))
Or a more hard-coded solution for older versions... of excel that just puts the words in the formula
=OR(ISNUMBER(SEARCH("Camera",B2)),ISNUMBER(SEARCH("torch",B2)),
ISNUMBER(SEARCH("messenger",B2)),ISNUMBER(SEARCH("internet",B2)))

Swapping two strings inside an excel cell with each other based on orientation within the cell

I'm trying to figure out how to swap certain characters with each other within a cell based on their orientation within the cell and not the actual characters themselves. This is because the strings are random. So for example, I would like to switch the 7th,8th, and 9th character with the 11th,12th, and 13th character.
How can I replicate this in a formula?
50000-ABC-123
50000-DEF-546
50000-GFD-456
50000-EDG-875
50000-SDF-304
50000-123-ABC
50000-546-DEF
50000-456-GFD
50000-875-EDG
50000-304-SDF
Another way is to use FILTERXML if you have the newest version of Excel, which will work even if the strings come in different lengths, but follow the same format (i.e. numbers-letters-numbers).
For example:
=TEXTJOIN("-",1,
INDEX(FILTERXML("<t><s>"&SUBSTITUTE(I2,"-","</s><s>")&"</s></t>","//s"),{1,3,2}))
Thanks to #JvdV for both the edit recomendation and the very encompassing explanation on FILTERXML here
Just use this formula in B1 and pull it down
=LEFT(A1,5) & RIGHT(A1,4) & MID(A1,6,4)

Make SumIf ignore words?

=SUMIF(E3:E,"YES",C3:C)
The above formula works in adding the numbers in C if the corresponding E cell is "YES", however my cells in C have "# MINS" in them, is there a way to make SumIf ignore words and only add the number?
SCREENSHOT OF SPREADSHEET: https://cdn.discordapp.com/attachments/358381825246101505/488443165364322327/Screenshot_1.png
If you’re using Google Spreadsheets, you have the possibility to format the numbers as you want.
In the cells, store the numbers only so that SUMIF will work, then create a custom number format: in the toolbar - Format - Number - More Formats - Custom number format - type in # “MINS”.
=SUMPRODUCT(LEFT(C3:C5,LEN(C3:C5)-LEN(" mins"))*(D3:D5="yes"))
This is an array like calculation. As such full column references may bog your computer down with excess calculations.
Get rid of the MINS. You can use Find & Replace or Text to Columns, etc.
Create a custom number format of 0 \M\I\N\S.
Use your original formula.
excel
=SUMIF(E:E,"YES",C:C)
google-spreadsheet
=SUMIF(E3:E,"YES",C3:C)
Shareable link

How to convert Text to numbers in Excel 2010?

I want to convert the numbers from text format to numbers so tha i can make the average or sum of the whole columns.
I tried all the possible ways asfar as i read in many blogs, but nothing works.
There is no Green mark on the cell nor a quote '
Tried copying an empty cell and select required cells and paste special methods also.
It looks like you are using a French version of Excel. In this case a number should be 6,04 and not 6.04
Do a find and replace of . for , and you should be able to change the format to a number if it is not done automatically.
You can either:
change the values to numbers
use a formula that can handle text-type numeric values
Say we have data in column A that is Text. This formula:
=SUMPRODUCT(--(A:A))
can give you the sum without having to convert first:

How to add cells with mix of 6 to 8 decimal places together

Because of floating point values, I cannot add a string of cells that contain values such as:
0.08178502
0.09262585
0.13261762
0.13016377
0.12302067
0.1136332
0.12176183
0.11430552
0.09971409
0.125285
Even if I try adding the first two through a sum formula or auto sum through selecting them, excel spits out an error. I have googled this like crazy and tried to change number formats. Is there a function that can allow me to add this information ?
Screenshot:
The spreadsheet is available on my Dropbox.
Those numbers are all preceded by a NBSP (Char Code 160). So, in order to sum them, you have to remove that. Many solutions. Here's one:
=SUMPRODUCT(--SUBSTITUTE(A1:A18,CHAR(160),""))
If a formula like:
=A1+A2+A3+A4+A5+A6+A7+A8+A9+A10
produces:
#VALUE!
then your "numbers" cells contain non-visible characters.
They must be removed before the formula will work.
If the cells contain text strings and not actual values you will need to convert the text to numeric values before performing any calculations. The function "=value(cell)" will bring the numeric value.
e.g.: A1 contains "000.12345678" (or some other non-numeric presentation of numerals)
In cell B1 type: =value(a1)
Cell B1 now operates as the real number 0.12345678
Oddly enough, the fact that it said 0.xxxxx in all numbers vs. .xxxxx is what the issue was. I'm just sharing that for folks who google/search and have same issue.
All I had to do was select that whole row and do a search in replace for "0." and make it just "." and now my numbers were usable in equations. For some reason the adjustment of formating as many searches suggested wasn't working

Resources