1. How To Create A Dynamic ListOf WorksheetNames In Excel
1. Select a cell in a blank sheet,here I selectA1, and then click Formulas > Define Name. see screenshot:
2. Then in the New Name dialog,type Sheets in to the Name textbox (you can change as you need), and type this
formula =SUBSTITUTE(GET.WORKBOOK(1),"["&GET.WORKBOOK(16)&"]","") into the Refers to textbox. See
screenshot:
3. Click OK. The go to the selected cell (A1) and type this formula =INDEX(Sheets,ROWS($A$1:$A1)) (A1 is the
cell you type this formula,"Sheets"is the name you defined in Step 2) into it, then drag the autofill handle down
until #REF! appears.
Tip: If there are worksheets removed or added, you need to go to A1and press Enter
key then rag the autofill handle again.
2. How to remove Untrimmable Spaces in Excel.
Amount
After TRIM
Addedx at the start
& endfor ref.
SUBSTITUTE
Approach
A
Convertedto number
300.00- x300.00-x x300.00-x 300.00
4,124,500.00 x 4,124,500.00 x x4,124,500.00x 4124500.00
300.00 x 300.00 x x300.00x 300.00
“A”=SUBSTITUTE(SUBSTITUTE(B5,CHAR(160),""),"-","")+0
How To VLOOKUP And Return Multiple Corresponding
Values Horizontally In Excel
=INDEX($C$2:$C$13,SMALL(IF(Sheet5!$H2=Sheet5!$B$2:$B$13,ROW(Sheet5!$B$2:$B$13)-
ROW(Sheet5!$B$2)+1),COLUMN(D2)))
3. For example, you have a range of data as below screenshot shown, and you want to
VLOOKUP the prices of Apple.
1. Select a cell and type this formula =INDEX($B$2:$B$9,
SMALL(IF($A$11=$A$2:$A$9, ROW($A$2:$A$9)-ROW($A$2)+1),
COLUMN(A1))) into to it, and then pressShift + Ctrl + Enter and drag the autofill
handle to right to apply this formula until #NUM! appears. See screenshot:
2. Then delete the #NUM!. See screenshot:
4. How To Lookup Value Return Multiple Corresponding
Values In Excel
Here is a long array formula can give a hand in looking up a value and return multiple
corresponding values.
1. Enter the value you want to look up in a blank cell. See screenshot:
2. In the adjacent cell, type this
formula =IF(ISERROR(INDEX($A$1:$B$7,SMALL(IF($A$1:$A$7=$D$4,ROW($A$1:$A$7)),ROW(1:1)),2)),"",
INDEX($A$1:$B$7,SMALL(IF($A$1:$A$7=$D$4,ROW($A$1:$A$7)),ROW(1:1)),2)) into it, and press Shift
5. + Ctrl + Enter keys together, then drag the Auto Fill to fill down the cells until the first
blank cell comes out. See screenshot:
Note: In the above formula, $A$1:$B$7 indicates the range data, $A$1:$A$7 stands
for the column range which your lookup the certain value in, $D$4 indicates the cell
you type look-up value in step 1, 2 indicates finding the corresponding values in
second column.
=SUMPRODUCT(($A$4:$A$5=A9)*($B$1:$M
$1=B9)*($B$2:$M$2=C9)*($B$3:$M$3=D9)*
($B$4:$M$5))
Type1 Type1 Type1 Type1 Type1 Type1 Type2 Type2 Type2 Type2 Type2 Type2
Vendor1 Vendor1 Vendor1 Vendor2 Vendor2 Vendor2 Vendor1 Vendor1 Vendor1 Vendor2 Vendor2 Vendor2
Minimum Average Median Minimum Average Median Minimum Average Median Minimum Average Median
USA 10 14 18 22 26 30 34 38 42 46 50 54
Canada 12 16 20 24 28 32 36 40 44 48 52 56
Country Type Vendor Cost Result
formula
result
USA Type1 Vendor1 Minimum 10 10
Canada Type2 Vendor2 Average 52 =SUMPRODUCT(($A$4:$A$5=A10)*($B$1:$M$1=B10)*($B$2:$M$2=C10)*($B$3:$M$3=D10)*($B$4:$M$5))
formula
result
=SUMPRODUCT(($A$4:$A$5=A10)*($B$1:$M$1=B10)*($B$2:$M$2=C10)*($B$3:$M$3=D10)*($B$4:$M$5))
6. How To Find The Max Or Min Value Based On Criteria
In Excel
=MAX(IF(A2:A13=F1,IF(B2:B13=F2,C2:C1
3))) with Then press Ctrl + Shift +
Enter keys simultaneously
To get the min value based on these
criteria, please apply this formula:
=MIN(IF(A2:A13=F1,IF(B2:B13=F2,C2:C13
))), and remember to press Ctrl + Shift +
Enter keys together.
To get the largest 3 or smallest 3 numbers
in a range:
=LARGE(A1:F12,1)&" "&LARGE(A1:F12,2)&", "&LARGE(A1:F12,3)
Multiple criteria in Excel Lookup formulas
7. =SUMPRODUCT((B3:B13=C16)*(C3:C13=C17)*(D3:D13))
How To Rank Range Numbers Uniquely Without Duplicates In Excel?
RANK(A2,$A$2:$A$11,0)+COUNTIF($A$2:A2,A2)-1
How To Extract First Two Or N Words From Text String
=TRIM(LEFT(A2, FIND("~",SUBSTITUTE(A2, " ", "~",3)&"~")))
=LEFT(TRIM(A2),FIND("^",SUBSTITUTE(TRIM(A2)&" "," ","^",3))-1)
How to repeat the same text written in separate line within a cell
Count linebreaks in cell
LEN(B5)-LEN(SUBSTITUTE(B5,CHAR(10),""))+1
To get the unique text
=LEFT($N5,(LEN($N5))/(LEN(N5)-LEN(SUBSTITUTE(N5,CHAR(10),""))+1))
Count cells that contain specific text
Generic formula
=COUNTIF(rng,"*txt*")
Explanation
To count the number of cells that contain certain text, you can use the COUNTIF function. In the
generic form of the formula (above), rng is a range of cells, txt represents the text that cells
should contain, and "*" is a wildcard matching any number of characters.
In the example, the active cell contains this formula:
8. =COUNTIF(B4:B11,"*a*")
How this formula works
COUNTIF counts the number of cells in the range that contain "a" by matching the content of
each cell against the pattern "*a*", which is supplied as the criteria. The "*" symbol (the
asterisk) is a wildcard in Excel that means "match any number of characters", so this pattern
will count any cell that contains "a" in any position. The count of cells that match this pattern is
returned as a number.
You can easily adjust this formula to use the contents of another cell for the criteria. For
example, if A1 contains the text you want to match, use the formula:
=COUNTIF(rng,"*"&a1&"*")
Case-sensitive version
If you need a case-sensitive version, you can't use COUNTIF. Instead you can test each cell in
the range using a formula based on the FIND function and the ISNUMBER function, as explained
here.
FIND is case-sensitive, and you'll need to give it the range of cells and then use SUMPRODUCT
to count the results. The formula looks like this:
=SUMPRODUCT(--(ISNUMBER(FIND(text,rng))))
Where text is the text you are looking for, and rng is the range of cells you want to count.
There's no need to use wildcards, because FIND will return a number if text is found anywhere
in the cell
How To Find And Select Duplicate Rows In A Range In Excel?
In the adjacent blank cell, cell D2 in this case, please enter the
formula =IF(SUMPRODUCT(($A$2:$A$10=A2)*1,($B$2:$B$10=B2)*1,($C$2:$C$10=C2)*1)>1,"D
uplicates","No duplicates")
Notes:
1. In the formula, $A$2:$A$10, $B$2:$B$10, $C$2:$C$10 indicate the range columns that you
want to find the duplicate from. You can change them as you want. And A2, B2, C2 indicate the
first cells in the each column of the data which needed to be applied this formula, you can
change them as well.
2. The above formula is based on data in 3 columns, if there are 4 columns in your data range
which needed to be found the duplicated values from the first row, and the formula will
become this: =IF(SUMPRODUCT(($A$1:$A$10=A1)*1,($B$1:$B$10=B1)*1,($C$1:$C$10=C1)*1,
($D$1:$D$10=D1)*1)>1,"Duplicates","No duplicates")
9. Text Function Generic formula
=TEXT(date,format)
Explanation
If you need to convert dates to text (i.e. date to string conversion) , you can use the TEXT
function. The TEXT function can use patterns like "dd/mm/yyyy", "yyyy-mm-dd", etc. to convert
a valid date to a text value. See table below for a list of available tokens.
How this formula works
Dates and times in Excel are stored as serial numbers and converted to human readable values
on the fly using number formats. When you enter a date in Excel, you can apply a number
format to display that date as you like. In a similar way, the TEXT function allows you to convert
a date or time into text in a preferred format. For example, if the date January 9, 2000 is
entered in cell A1, you can use TEXT to convert this date into the following text strings as
follows:
=TEXT(A1,"mmm") // "Jan"
=TEXT(A1,"dd/mm/yyyy") // "09/01/2012"
=TEXT(A1,"dd-mmm-yy") // "09-Jan-12"
Date format codes
Assuming a date of January 9, 2012, here is a more complete set of formatting codes for date,
along with sample output.
Format code Output
D 9
Dd 09
Ddd Mon
Dddd Monday
M 1
Mm 01
Mmm Jan
Mmmm January
10. Mmmmm J
Yy 12
Yyyy 2012
mm/dd/yyyy 01/09/2012
m/d/y 1/9/12
ddd, mmm d Mon, Jan 9
mm/dd/yyyy h:mm AM/PM 01/09/2012 5:15 PM
dd/mm/yyyy hh:mm:ss 09/01/2012 17:15:00
You can use TEXT to convert dates or any numeric value in a fixed format. You can explore
available formats by navigating to Format Cells (Win: Ctrl + 1, Mac: Cmd + 1) and selecting
various format categories in the list to the left
Count specificwords in a cell
=(LEN(text)-LEN(SUBSTITUTE(text,word,"")))/LEN(word)
Count Text Occurrences
This example teaches you how to count the number of occurrences of text in a range.
11. 1. For example, to count the number of cells that contain exactly star.
2. For example, to count the number of cells that contain exactly star + 1 character. A question
mark (?) matches exactly one character.
3. For example, to count the number of cells that contain exactly star + a series of zero or more
characters. An asterisk (*) matches a series of zero or more characters.
4. For example, to count the number of cells that contain star in any way. No matter what is
before or after star, this function finds all the cells that contain star in any way.
12. 5. For example, to count the number of cells that contain text.
FIn Excel, you can use the following simple formulas to add dashes to the phone numbers
with these steps:
1. In a blank cell which besides your phone numbers to enter this
formula: =REPLACE(REPLACE(A2,4,0,"-"),8,0,"-"), see screenshot:
2. Then drag the fill handle over to the range that you want to apply this formula, and the
dashes have been inserted into the phone numbers.
13. Notes:
1. Except the above formula, here is another formula also can help you: =TEXT(A2,"???-???-
????"). You can use any of them.
2. In the above formulas, A2 indicates the cell that contains the phone number you want to
add dashes. You can change this arguments as you need.
Add Dashes To Phone Numbers With Format Cells Function
The Format Cells feature in Excel also can help you to deal with this task. Please do as these:
1. Select the phone numbers that you want to add the dashes.
2. Right click to choose Format Cells from the context menu, see screenshot:
14. find out the position of last back slash
Get first name fromnamewith comma
=RIGHT(B4,LEN(B4)-FIND(", ",B4)-1)
Get last namefrom name with comma
=LEFT(B4,FIND(", ",B4)-1)