Find only two decimals - excel

I am very new to Excel, a beginner! I need a formula/macro to find 1-2 decimals in a column. The column contains job codes for all levels of the organization. It would look something like this:
xx.xxx
xx.xxx.xxx
xx.xxx.xxx.xxx
xx.xxx.xxx
xx.xxx.xxx.xxx
xx.xxx.xxx.xxx.xxx
xx.xxx.xxx.xxx.xxx.xxx
xx.xxx.xxx.xxx.xxx.xxx.xxx
I need to find only the job codes with one or two decimals, which specify a certain position in the organization, the end result looking like this:
xx.xxx
xx.xxx.xxx
xx.xxx.xxx
Does anyone have any ideas on how to do this? Thank you in advance!

You could use a helper column to count the occurrence of . and then just filter this column:
=LEN(A1)-LEN(SUBSTITUTE(A1,".",""))

To Do it without a helper column:
=IFERROR(INDEX($A$2:$A$9,AGGREGATE(15,6,(ROW($A$2:$A$9)-ROW($A$2)+1)/(LEN($A$2:$A$9)-LEN(SUBSTITUTE($A$2:$A$9,".",""))<=2),ROW(1:1))),"")

Related

How to use index and match with two columns?

I have the following case
E.g., I want the two cells in yellow to be the same. For this, I need to find the columns Score 1 and Result, and then find the row 03-Jan so that I get the actual score. Do you have any idea how to solve this? I tried with some match and index but I do not get the solution.
Use INDEX with three matches, the first to find the correct row, while the other 2 find the correct column.
=INDEX($E:$N,MATCH($Q9,B:B,0),MATCH(R$8,$E$2:$N$2,0)+MATCH(R$7,$E$3:$I$3,0)-1)
You want to use an Index(Match),Match())
but what you really want to use is a double XLOOKUP.
I also liked this video to help me learn all of the ways to do a 2d lookup.
YouTube Video

COUNTIFS when counting distinct values

I've got a table that looks something like this
what I want to do is have a formula that counts how many distinct machines are used on each hospital in between 04/06/2021 and 07/06/2021
So I would get something like this
I feel like this could be done with a COUNTIFS but somehow make it count only distinct values. I'm just not sure of how I could do this. Can someone help me with this? Thanks
To expand on the comments, if you have the newest version of Excel you can use functions like FILTER, COUNTA, and UNIQUE.
For example, after getting the unique hospitals with UNIQUE, try something like:
=COUNTA(UNIQUE(
FILTER($B$2:$B$10,
(($C$2:$C$10<DATEVALUE("1/5/2021"))*
($C$2:$C$10>=DATEVALUE("1/1/2021"))*
($A$2:$A$10=$F2)))))

Concatenate the shortcut st, nd, rd to column value - Excel

Column A has numbers from 1 - 5 and in column B i want to concatenate the number of Column A with the relevant nth term as indicated in the image below. Any help will be greatly appreciate!
Without using VBA, your best option would be the "CHOOSE()" function.
Try something like this for any number > 0:
=IF(AND(MOD(ABS(A1),100)>10,MOD(ABS(A1),100)<14),"th",CHOOSE(MOD(ABS(A1),10)+1,"th","st","nd","rd","th","th","th","th","th","th"))
You can set up a named "key" separately, much like the table you are showing, and then reference the key to replace any number with the desired output.
You can then indexmatch/vlookup the number, referencing the table, to find the output.
For ex:
=vlookup($A1,key,2,FALSE)
you could use nested IF functions and RIGHT like this
=IF(OR(RIGHT(H2,2)="11",RIGHT(H2,2)="12",RIGHT(H2,2)="13"),CONCAT(H2,"th"),IF(RIGHT(H2,1)="1",CONCAT(H2,"st"),IF(RIGHT(H2,1)="2",CONCAT(H2,"nd"),IF(RIGHT(H2,1)="3",CONCAT(H2,"rd"),CONCAT(H2,"th")))))
Probably not the fastest performance wise

How to use wildcards on numbers in an Advanced Filter (Excel)

I have a table in an Excel sheet and I use Advanced filter to sort out data. One column of the table consists of number ID like this:
81089
81087
81009
81023
91087
91065
I found out that wildcards (*) doesn't work with numbers. Even if the numbers are formated as text. My question is how to make a simple filter where I would like to sort out numbers starting with 81 as 81* doesn't work. From what I've read and found filtering numbers should work only with logic operators (< > =). Isn't there a trick how to get around with this?
Thanks for any answer in advance.
Use a mathematical equivalent.
For example, if all of your numbers are five digits, as you show in your screenshot, then
Another method is to use a text function as a formula criteria. Then the number of digits is irrelevant.
For example, if your first data element is in A18:
=LEFT(A18,2) = "81"

How to create a bar chart that counts how many times comma separated values appears?

My data(a column) is from a question which allowed multiple responses. So in each cell I have something like "A,C,E" and I'd like to create a bar chart with each answer as a category(A,B,C,D and E). I know the basics of pivot tables. Thanks in advance.
You can use SUBSTITUTE and LEN to count the number of commas.
=LEN(A1)-LEN(SUBSTITUTE(A1,",",""))
For example that would return:
A,C,E 2
A,C,E,F 3
A,C,E,D,E 4
If you actually want to analyse each letter (which I think is what you really want to do), then you'll need something more like the equivalent of explode in PHP. There's some more information at https://support.office.com/en-us/article/Split-text-into-different-columns-with-functions-49ec57f9-3d5a-44b2-82da-50dded6e4a68
I did it by using the formula =IF(ISNUMBER(FIND("A",cellname)),1,0).
Problem solved.

Resources