So I have to get in a cell a single digit number.If I get 92 I need to do 2+9=11 and after 1+1 =2 so 2 is my number.How I can do this with a single function?
Simply:
=1+MOD(A1-1,9)
Regards
You need to first validate the cell value by using below formula
=COUNT(FIND({0,1,2,3,4,5,6,7,8,9},A1))>0
if above is true then only use below formula to get your number
=left(A1,1)
=right(A1,1)
Store into a variable and than try to read digit if more than 2. May be this is helpful.
Related
having this data in excel cell
kerass(xcvbn=2, abcdefg_iD='510863005')
having 100000 of records so, how to extract id number using excel formula from that excel sheet
Thanks in advance
Assuming your value is in cell A2. Here is a formula to be inserted
=SUBSTITUTE(RIGHT(A2,LEN(A2)-SEARCH("_iD='",A2)-4),"')","")
This means:
Search for "_iD='"
Once found, subtract the length of "_iD='" of that location (hence the 4)
Use the total length of the string, subtracted with location and 4, in order to find where the actual identifier begins
Take the right part of the string, only the part behind "_id='...'" remains
In that part, replace "')" by an empty string (otherwise you get "...005')"
Alternative answer:
=MID(A1,FIND("'",A1)+1,9)
The find formula finds the first "'" starting position
Assuming all the ID's are 9 digits, the MID formula uses the starting pos. from find and takes the following 9 digits.
So assuming your text is in cell A2, and that the id is the first 9 characters of the last 11 then this is the simplest I can think of:
=LEFT(RIGHT(A2,11),9)
But if extra characters get added or the ID changes length.
Does have the benefit of being minimalist on functions and low volativity.
Within Excel, is there an array formula or something else that could shorten the formula below? This is only an example going through 12 rows. The actual formula would have thousands of rows, which is why I'd like to find a way to write this formula much shorter. I've considered and tried SUMIF and SUMPRODUCT in addition to what's below, but I haven't found a way for it to check for a specified value in multiple columns, and then doing that for many rows, like a FOR loop would do. The below formula is in Cell J3. I have attached an image of the spreadsheet example.
=SUM(
IF(ISNUMBER(MATCH($I$3,$B3:$E3,0)),$F3,0),
IF(ISNUMBER(MATCH($I$3,$B4:$E4,0)),$F4,0),
IF(ISNUMBER(MATCH($I$3,$B5:$E5,0)),$F5,0),
IF(ISNUMBER(MATCH($I$3,$B6:$E6,0)),$F6,0),
IF(ISNUMBER(MATCH($I$3,$B7:$E7,0)),$F7,0),
IF(ISNUMBER(MATCH($I$3,$B8:$E8,0)),$F8,0),
IF(ISNUMBER(MATCH($I$3,$B9:$E9,0)),$F9,0),
IF(ISNUMBER(MATCH($I$3,$B10:$E10,0)),$F10,0),
IF(ISNUMBER(MATCH($I$3,$B11:$E11,0)),$F11,0),
IF(ISNUMBER(MATCH($I$3,$B12:$E12,0)),$F12,0),
IF(ISNUMBER(MATCH($I$3,$B13:$E13,0)),$F13,0),
IF(ISNUMBER(MATCH($I$3,$B14:$E14,0)),$F14,0))
Use SUMPRODUCT like this:
=SUMPRODUCT($F$3:$F$14*(MMULT(N($B$3:$E$14=I3),TRANSPOSE(COLUMN($B$3:$E$14)^0))>0))
This is an array formula and it needs to be confirmed with Ctrl-Shift-Enter instead of Enter when exiting edit mode.
Improved solution
=SUMPRODUCT($F$3:$F$14,CEILING(((($B$3:$B$14=$I3)+($C$3:$C$14=$I3)+($D$3:$D$14=$I3)+($E$3:$E$14=$I3))/4),1))
Idea : 4 is the number of rows/week. Use ceiling() to normalize value instead of int() n sqrt().
Expansion note : just add another row condition & adjust 4 to the number of rows.
Past solution (for reference)
=SUMPRODUCT($F$3:$F$14,INT(SQRT(INT(SQRT(($B$3:$B$14=$I3)+($C$3:$C$14=$I3)+($D$3:$D$14=$I3)))+($E$3:$E$14=$I3))))
should do.
idea : while $B$3:$B$14=$I3 part is creating an array of 0 n 1, the INT() n SQRT() function 'force' the '+' sum to become 1 even if there is more than 1 match in the same month.
please share if it works/not. (:
p/s : (note for expansion) Upon dissecting the int() and sqrt() function, you can see that sqrt(3)=1.73205 , sqrt(2)1.414213, sqrt(1)=1 and its int() results the same value (1) . So let say you want to add more rows, just use 'bundle' 3 rows together in one int(sqrt(__)) function, recursively.
I am not an Excel expert and I need some help.
I have a list of different numbers and a reference number. I have a formula where it gives me the closest value of my number from this list
Example:
10
11
16
20
30
My reference number is 13.
I have found online a formula that gives me the closest number which in this case is the number 11.
=INDEX(list;MATCH(MIN(ABS(list-reference_number));ABS(list-reference_number);0))
But I want the result to be 16 (the next highest number).
I would like to know if this is possible and how can I achieve it.
Thanks in advance!
Since MATCH(refernce,list) will return the closest to 13. That means MATCH(refernce,list)+1 will return the result you looking for:
Formula in to use:
=INDEX(C1:C5,MATCH(13,C1:C5)+1)
Here's another Array formula for you to try (Ctrl+Shift+Enter):
=SUMPRODUCT(MIN(IF(A1:A5-B1>0,A1:A5)))
Provided column A contains the numbers, which can be unsortet by the way, you can get the closest higher number with:
{=MIN(IF($A:$A>B1,$A:$A,MAX($A:$A)+1))}
B1 contains the reference number (in your case 13).
Note: This is an array formular. You don't have to enter the curly braces. Instead paste the formular without { and } and press Ctrl + Shift + Enter to confirm your input.
2.375;26.375;0.743|98.375;26.375;0.743|98.375;2.375;0.743|2.375;***2.375***;0.743|2.375;26.375;0.743555
I'm trying to return the second value equaling 2.375 after the 3rd "|". What's the best way to do this?
Thanks!
Asuming the string is in cell A1 (and the numbers are always 5 chars in length), the following formula will work:
=MID(A1,FIND(";",A1,FIND("|",A1,FIND("|",A1,FIND("|",A1)+1)+1)+1)+1,5)
OR - to handle any length number you can do this:
=MID(A1,FIND(";",A1,FIND("|",A1,FIND("|",A1,FIND("|",A1)+1)+1)+1)+1,FIND(";",A1,FIND(";",A1,FIND("|",A1,FIND("|",A1,FIND("|",A1)+1)+1)+1)+1)-FIND(";",A1,FIND("|",A1,FIND("|",A1,FIND("|",A1)+1)+1)+1)-1)
This formula will bring the second number after the third | regardless of size.
=--TRIM(MID(SUBSTITUTE(TRIM(MID(SUBSTITUTE(A1,"|",REPT(" ",999)),3*999,999)),";",REPT(" ",999)),999,999))
We can easily make this formula dynamic:
=--TRIM(MID(SUBSTITUTE(TRIM(MID(SUBSTITUTE(A4,"|",REPT(" ",999)),(C1-1)*999+1,999)),";",REPT(" ",999)),(C2-1)*999+1,999))
This will allow you to specify the group and the sequence in that group to return the desired number.
I am trying to use a formulated cell to make a condition, but it failed.
For example:
Cell A1 contains number '12345'
In Cell B1, I insert '=Left(A1,3)', so it returns '123'
In Cell C1, I insert '=IF(B1=123,"Yes","No")', it should return Yes, but I don't know why it returns No.
Any idea about this?
Thanks in advance
When you use the LEFT function on a number it changes the number to text. Try:
=LEFT(A1,3)+0
Using a math operation such as "+0" will change the text back to a number.
Are you sure it returns 123? It could just return 3 because it is the 3rd character on the left of the cell! You might want to check this.