Newbie needs Excel suggestions with a simple script - excel

I have a excel file and I would like to search on a specific column. I would like to know how many times a specific "letter/character" has been used. In my case its the letter "x". So after little research I found that formula:
=COUNTIF(D2:D48,"FIDELIO")
the problem here is, I always get an error message:
If I write the Code with an " ` " in front like this:
`=COUNTIF(D2:D48,"FIDELIO")
excel just writes me the code in excel as a text and not as a code.
Tried to write the Code with an "`" in front like this:
`=COUNTIF(D2:D48,"FIDELIO")
But then excel just writes me the code as a text and not as a code.
Here is another picture:

came across this, hope this helps!
Formula to Count the Number of Occurrences of a Single Character in a Range
=SUM(LEN(range)-LEN(SUBSTITUTE(range,"a","")))
Where range is the cell range in question, and "a" is replaced by the character you want to count.
https://learn.microsoft.com/en-us/office/troubleshoot/excel/formulas-to-count-occurrences-in-excel

Related

Attempting to use IFS, ISNUMBER, SEARCH, LEFT together to evaluate and output specific string of text

I'm attempting to use the IFS, ISNUMBER, SEARCH, LEFT Excel formulas together in order to evaluate if a cell contains a specific designation in the first two characters of the text string in a specific cell and then output a specific text string into a different cell.
I have tried using various functions to accomplish this and my current code iteration seems close to working but it currently searches the entire cell (seemingly) ignoring my LEFT("14",2) argument.
The code 'works' as is but it will also 'work' if there is "14" anywhere in the cell, not just the first two characters of the cell. I have attempted to use the LEFT() function to evaluate the first 2 characters in the cell and then if TRUE it would output the "OUTPUT TEXT" but no success thus far.
I am new to nesting formulas in Excel so would appreciate insight as to why my code below isn't working as I intended. If there's a more streamlined way to accomplish this (without using VBA due to security restrictions) I am keen to learn... there's typically a more elegant solution to most things! Thank you for taking a look.
CODE:
=IFS(ISNUMBER(SEARCH("ABC",B21)),"Section One",(ISNUMBER(SEARCH("DEF",B21))),"Section Two",ISNUMBER(SEARCH("GHI",B21)),"Section Three",ISNUMBER((SEARCH(LEFT("14",2),B21))),"OUTPUT TEXT",TRUE,"MANUAL CHECK")
The cell B21 refers to where the text would be input in this format "14ABC1234".
PROBLEM:
Input of "14ABC1234" resolves as TRUE (as intended) but "10ABC1423" is also picked up as TRUE even with SEARCH(LEFT("14",2),B21).
Sidenote: I've also used IFS and ISNUMBER(SEARCH()) to evaluate if 'ABC'/'DEF'/'GHI' etc are within the cell and this has been working as intended.

COUNTIF formula counts values that don't match

I'm using counting invoice numbers (text) in a table's column, but the Excel formula seems to be confusing some values.
I copied small sample of these - please refer to below:
The formulas are as follow:
=COUNTIFS(A1:A19,A1)
=COUNTIF(A1:A19,A1)
As you can see these invoice numbers differ and the results of these functions suggest as if all were the same.
I googled it for 1 hour but I didn't find such as issue as mine.
If anybody had any clue why could this behave in such way I'll be super grateful!
Rob
Each time you copy down this formula it will add 1 row to each. For example the second row of datas formula will be =COUNTIFS(A2:A20,A2). To lock these cells in the formula use $
Your formula should be =COUNTIFS(A$1:A$19,A1)
I've solved this myself:
ROOTCAUSE
Excel tried to be helpful and read these invoice numbers as actual numbers (despite these being defined already in Power Query as text)
Then, Excel fooled me and despite showing that it works on it as a string (I was evaluating the formula) it worked on it as number
Above means that it transformed exemplary "00100001010000018525" to 1.00001E+17, which cut down this to "100001010000018000" - that's the moment Excel stopped fooling around and showed that value in the formula bar.
I think I don't need to tell why countif perceived all these values as equal.
SOLUTION
I simply appended one letter after each invoice number to get e.g. "00100001010000018525a" what forces Excel to quit its gimmicks and games.
Case closed.
I suspect this is a bug in COUNTIF, or maybe by design.
However, to workaround this in the formula, without having to change your data, try adding a wild-card character:
=COUNTIF(A1:A19,"*"&A1)

Excel: If vlookup returns specific text, countifs number of instances (multiple)

First post, but I am stuck and was hoping for some help. What I am trying to do is use a nested IF formula to determine whether the value returned by a VLOOKUP matches specific text on another sheet in the same workbook. If it does, to then use the COUNTIFS function to determine the sum of instances that specific text contained in a specific cell appears on another sheet (also in the same workbook).
One part of these formulas seems to work, but when I combine it with others, it errors and I can't figure out why.
It's probably something simple, but I'd appreciate any help. Here's the part that seems to "work"
=IF(VLOOKUP($A3,'Sheet1'!$B:$D,3,FALSE)="All",
(COUNTIFS('Sheet2'!$U:$U,'Sheet3'!$A3,'Sheet2'!$C:$C,"MM/DD/YYYY")
+
(COUNTIFS('Sheet2'!$R:$R,'Sheet3'!$A3,'Sheet2'!$C:$C,"MM/DD/YYYY")))
If I put one more parenthesis, it works as is, but seems to omit some of the "All" Vlookup results... thus why I put works in quotations above. That might be an issue with my spreadsheet though, but felt I should include in case I'm just being idiotic. Regardless, when I input two additional IF statements, it errors.
The final formula I've crafted looks like this (double spaced for ease of reading only):
=IF(VLOOKUP($A3,'Sheet1'!$B:$D,3,FALSE)="All",
(COUNTIFS('Sheet2'!$U:$U,'Sheet3'!$A3,'Sheet2'!$C:$C,"MM/DD/YYYY")
+
(COUNTIFS('Sheet2'!$R:$R,'Sheet3'!$A3,'Sheet2'!$C:$C,"MM/DD/YYYY")))),
IF((VLOOKUP($A3,'Sheet1'!$B:$D,3,FALSE)="One",
(COUNTIFS('Sheet2'!$U:$U,'Sheet3'!$A3,'Sheet2'!$C:$C,"MM/DD/YYYY")),
IF((VLOOKUP($A3,'Sheet1'!$B:$D,3,FALSE)="Two",
(COUNTIFS('Sheet2'!$R:$R,'Sheet3'!$A3,'Sheet2'!$C:$C,"MM/DD/YYYY"),
IF((VLOOKUP($A3,'Sheet1'!$B:$D,3,FALSE)="Three",
(COUNTIFS('Sheet2'!$U:$U,'Sheet3'!$A3,'Sheet2'!$C:$C,"MM/DD/YYYY")),"0"))
Any ideas?
Thanks!
Ryan Olson
Just cleaned up some bracketing. Let me know how it goes as I didn't alter the formula otherwise.
=IF(VLOOKUP($A3,Sheet1!$B:$D,3,FALSE)="All",
COUNTIFS(Sheet2!$U:$U,Sheet3!$A3,Sheet2!$C:$C,"MM/DD/YYYY")+(COUNTIFS(Sheet2!$R:$R,Sheet3!$A3,Sheet2!$C:$C,"MM/DD/YYYY")),
IF(VLOOKUP($A3,Sheet1!$B:$D,3,FALSE)="One",
COUNTIFS(Sheet2!$U:$U,Sheet3!$A3,Sheet2!$C:$C,"MM/DD/YYYY"),
IF(VLOOKUP($A3,Sheet1!$B:$D,3,FALSE)="Two",
COUNTIFS(Sheet2!$R:$R,Sheet3!$A3,Sheet2!$C:$C,"MM/DD/YYYY"),
IF(VLOOKUP($A3,Sheet1!$B:$D,3,FALSE)="Three",
COUNTIFS(Sheet2!$U:$U,Sheet3!$A3,Sheet2!$C:$C,"MM/DD/YYYY"),"0"))))

Finding changing text in Excel or Google Spreadsheet

hope you can help with an Excel or Google Spreadsheet question.
In one column I have different words, which I would like to search for in a certain area in the spreadshet. Fx. is B3 present from B50:B678 is B4 present from B50:B678 and so on. The text is not an exact match. That means that sometimes the searchwords is placed in the whole sentes. See this data for an excample: https://docs.google.com/spreadsheets/d/1MX8WsnwcxEety-sv2ttEcUqgAgEUbpUd_xD18cG20lk/edit#gid=574850130
Hope you can help. With no succes I have tried these formulas:
=ifError(filter($B$775:$B$7887,ifError(search(B4,$B$775:$B$7887),false)))
=IFERROR(IF(UNIQUE(FILTER(B776:B7888,B776:B7888=B3))="text","Found","Not Found"),"Not Found")
=search(B3,J3:J98)
But the formulas don´t work if there is no excact match...Hope you can help
Best regards
Kåre Kildall Rysgaard
Datajournalist, Analystik.dk
In Google Spreadsheet count the number of occurrences of your search string within the test range by embedding the test string within wildcard characters:
=if(countif(A$15:A$2100,ʺ*ʺ&A4&ʺ*ʺ)>0,ʺFoundʺ,ʺNot Foundʺ)
The answer in Excel is similar but note that double quotes in Excel use a different character to that in Google Spreadsheet:
=IF(COUNTIF(A$15:A$2100,"*"&A4&"*")>0,"Found","Not Found")
It appears that Google Spreadsheet uses ANSI 63 for double quotes while Excel uses ANSI 34.

Vlookup not working for specific text

I am working on two sheets of text, Lets say "apples" in sheet1 and i want to find the cells which contains "apples" in sheet2. Below function works for few columns and its not working for few columns even though the text is in both places..
=VLOOKUP("*"&apples&"*",Sheet2!H4:H499,1,FALSE)
I think, its because of the text format in sheet2. I removed unwanted chars using "clean" & "trim" function. but still having issue...
Have anyone faced this issue before...?
Update - This looks more of text format issue. I copied to notepad and found no unreadable chars or new lines...
Instead of
=VLOOKUP("*"&apples&"*",Sheet2!H4:H499,1,FALSE)
please consider using
=VLOOKUP("*apples*",Sheet2!H:H,1,FALSE)
Update - changed to deal with asterisk that I didn't see the first time I tried to answer this.
You need to fix your cells, i.e. change Sheet2!H4:H499 to Sheet2!$H$4:$H$499!
Without doing this, the range you're running the lookup in will move downwards when copying the formula - which is certainly not what you want! :-)
I had some issues with this recently.
I wanted to document that I tried:
look for trailing spaces
numbers formatted as text
ensured arrays were reference locked correctly (e.g. put a $ in front of the part of reference that shouldn't change)
When it still didn't work I copied both values into Notepad++ and changed encoding from UTF-8 to Ansi. What I found was there was a strange hidden character in one of the texts. It was like one of the values had been pasted from word and the space as a "special space" or something. You can get this when a dash is not really a dash but an endash etc.
To fix I pasted my range into Notepad++, changed encoding, search/replace all strange characters with nothing then pasted back into Excel. Then it worked just fine.

Resources