I am trying to display the next ID number using the max formula for a column that contains an ID number with both text and number (e.g., XXX0043). Can someone help?
assuming your IDs are in A1:A10, and the numeric part is always the last 4 characters:
=MAX(--right(A1:A10,4))
use CONTROL+SHIFT+ENTER when confirming the formula instead of just ENTER. You will know you have done it right when { } show up around your formula. Note that the { } cannot be added manually.
UPDATE: Based on Solar Mikes comment
="xxx"&RIGHT("0000"&MAX(--right(A1:A10,4)),4)
With the assumption that xxx does not change...if xxx changes then it a little more complicated.
Related
Good morning,
I am working on this exercise where i have to count how many unique names start with "DOT" or "PRO" in a column. This has to be made respecting filters that may come from other column. I try to list an example of the table in the pic attached.
In this example it is possible to only filter by hair, but i may have more columns.
So, let's say i do not apply any filter:
PRO = 2;
DOT = 1.
Filtering for Black hair:
PRO = 0;
DOT = 1
I hope I've explained what i need completely, and i thank you in advance for the help!
P.S. An excel formula would be perfect, but VBA code is useful as well.
This what I try base of what I understand to your question, may be it could help
Might be useful to create a column helper and subtotal and for your filter value.
You can try to use an Array formula:
{=SUM(IF(LEFT(A:A,3)="DOT",1,0))}
To get the brackets around the formula, you need to press ctrl+shift+enter instead of just enter.
If you want to count the unique ones:
{=COUNTA(UNIQUE(IF(LEFT(A:A,3)="DOT",A:A,"")))-1}
This Array formula creates an array with either the value if it starts with DOT, or an empty string. Then the unique values are counted with UNIQUE and COUNTA. You need to use -1, because all other values are shown as "" and that also counts as a unique value.
I have a table where I enter the qualification times manually Name and Timer. It calulates the Final Time automatically, but I want it to sort the Final Time and Name in the right side from the fastest to the slowest, as in the second image. I tried using VLOOKUP and INDEX, but didn't manage to get it. I need help finding the right formulas to Cells I$ and J$. I hope to get a answer from here.
Hope to get it like following:
Use this formula in your column J. Enter it in J3 and copy down. As you see, it refers to column H where it expects the numbers 1 and up. So, it will look for the smallest, second smallest etc values in the given range.
=SMALL($D$3:$D$6,H3)
In I3 please enter the formula below and copy down.
=INDEX($B$3:$B$6,MATCH(J3,$D$3:$D$6,0))
It looks for the value the SMALL function extracted and finds the matching name.
In addition to the question I posted previously, (Change text length based on drop down option selected), I have another scenario where a Bank's account numbers (BANK C) are either 10 or 15 digits long. The answer to my previous question facilitated changing the text length to a range (between 10 and 15 digits) and changing the text length to exactly 12 digits, by creating a lookup table and defining the min and max values.
I was told that a different approach would be needed to change the text length to either one of two values (meaning either 10 or 15 digits), but nothing I've tried so far has worked.
As shown in the last question:
I am using the following table:
I am using the following formula in my Data Validation:
=AND(LEN(B2)<=VLOOKUP(A2,F:H,3,FALSE),LEN(B2)>=VLOOKUP(A2,F:G,2,FALSE))
VLOOKUP will only return the first line and I need it find multiple so I can test against those.
How can I go about getting this to work, while still allowing the other two ways to work?
Maybe slightly different approach as shown below. Validation rule formula seems working to me:
=NOT(ISERROR(MATCH(LEN(C3),OFFSET($G$4:$G$9,,MATCH(B3,$G$3:$I$3,0)-1),0)))
We are just checking if we can find length in specific column in the table. Possible values means all possible lengths. You can also build your table horizontally, but this will require some formula adjustments. If you want, you can either expand Range G4:G9 and G3:I3 or change it to named range, or try referencing to column and header of table - these solutions will make our validation formula flexible (when you add item to list, formula will change automatically).
I am pretty sure that it is also possible to simplify that formula.
I'm sorry for cutting row numbers in the screenshot.
The following formula worked for me:
=IF(AND(ISNUMBER(SEARCH(1, A4)), AND(LEN(B4)>MIN(9), LEN(B4)<MAX(16))), TRUE, IF(AND(ISNUMBER(SEARCH(2, A4)), LEN(B4)=12), TRUE, IF(AND(ISNUMBER(SEARCH(3, A4)), OR(LEN(B4)=10, LEN(B4)=15)), TRUE,FALSE)))
So basically if "1" is found in cell A4, where the drop-down list of all the bank names is, it will only allow between 10 and 15 characters to be entered into cell B4 (where i'm inputting the bank account number). If "2" is found in cell A4, it will only allow 12 characters to be entered and if "3" is found in cell A4, only 10 OR 15 characters can be entered. Thanks for the replies though everyone.
Having issues with merging some IFs and VLOOKUPs most probably.
Basically, workflow would look like below and I don't quite know how to type it into one formula.
Look for value from Values to look for in the table on the right hand side.
If found in the list text string, return the corresponding value from add/remove column to B column.
Excel screenshot sample
The answer will only work if you make the name for the values unique. What I mean by this is, that you will need to change the name of value1 to value01 if you have more than 10 values. If you have more than 100 values, than you will need to change the name to value001 and so on.
Then use this in B2 and drag down as needed:
{=INDEX($D$3:$D$6,MATCH(TRUE,FIND(A2,$E$3:$E$6)>0,0))}
NOTE: you dont have to entere the brackets {}. These just indicate that this is an array-formula. This needs to be entered with CTRL + SHIFT + ENTER instead of the normal ENTER.
try this formula: =IF(IFERROR(SEARCH(A2,E2),"Not Found")="Not Found","Not Found",D2)
also please see the screenshot attached Example
In my sheet I have a Column1 with text and a Column2 with random numbers.
I would like to get a Column3 with the five "highest texts" for example:
I know I can get the text if I make an Index/Match looking for the number, but I'm lost at the sorting part.
Place this in cell C1 and drag down:
=LOOKUP(REPT("z",255),IF(LARGE($B$1:$B$10-(ROW($B$1:$B$10)/9^9),ROWS($A$1:A1))=$B$1:$B$10-(ROW($B$1:$B$10)/9^9),$A$1:$A$10))
This needs to be entered with CTRL + SHIFT + ENTER.
Use a 'helper column' to get the top 5 numbers with the LARGE function then use INDEX on column A, returning the appropriate row number with AGGREGATE and COUNTIF function to offset duplicates.
additional variant to already posted:
=INDIRECT("A"&MATCH(LARGE(B:B,ROW(A1)),B:B,0))
test:
The question is: What if there is not a clean break between 5th and 5th place? For example what if f was also a 6? This would then be tied for with the others how does one descriminate?
The following will bring out only the 1st through the 5th but allow for ties that might push the actual number past 5 due to ties.
Put the following in C2:
=IF(OR(ROW(1:1)<=5,COUNTIF($C$1:$C1,INDEX($A$1:$A$10,MATCH(LARGE($B$1:$B$10,ROW(1:1)),$B$1:$B$10,0)))>0),INDEX($A$1:$A$10,MATCH(1,INDEX(($B$1:$B$10=LARGE($B$1:$B$10,ROW(1:1)))*(COUNTIF($C$1:$C1,$A$1:$A$10)=0),),0)),"")
It is an array formula and must be confirmed with Ctrl-Shift-Enter. Then copy it down ten rows(in the picture the formula is copied down ten rows).
Now we change f to be 6 so it is tied for fifth:
And it gets added to the list.
You could just limit the output to five rows. But then it would be excel deciding what is the top five. If this is what you want than any of the other answers will work.