Tuesday, September 6, 2016

Extract/ Get Month name from date in excel

Month from a Date

If only want a month to appear from a date, No need for any formula,
Just press CTRL + 1 and under custom settings change the format to :
"mmm"  // "Jan"
"mmmm" // "January"

Excel will display only the month name, but it will leave the date value intact.

However, if you want to remove the date and only show the month:
then use formula : =text(b4,"mmm")

A more flexible way

If you want maximum flexibility, you can "map" the month to a month name directly in the CHOOSE function like so:
=CHOOSE(MONTH(B4),"Jan","Feb","Mar","Apr","May","Jun","Jul","Aug","Sep","Oct","Nov","Dec")
Enter the month names you want to return (abbreviated or not) as values in CHOOSE, after the first argument, which is entered as MONTH(date). MONTH will extract a month number, and CHOOSE will use this number to return the nth value in the list. This works because MONTH returns a number 1-12 that corresponds to the month name.
CHOOSE is more work to set up, but it is also more flexible, since it allows you to map a date toany values you want (i.e. you can use values that are custom, abbreviated, not abbreviated, in a different language, etc.)

Saturday, October 3, 2015

Vlookup with multiple conditions met and return value

You can't use VLOOKUP like that but you can use a different formula, e.g. to find the first row where the criteria is met in columns A, B and C and then return the value from D

=INDEX(D1:D100,MATCH(1,(A1:A100="x")*(B1:B100="y")*(C1:C100="z"),0))

confirmed with CTRL+SHIFT+ENTER

Friday, November 7, 2014

Auto Fill drop down list with Search Suggestions

A rather simple way of having this feature enable is:
1- Add a combo filter list box from developer options.
2- Click "view source code"
3- Add the following VBA code:

Private Sub ComboBox1_GotFocus()
ComboBox1.ListFillRange = "=DropDownList"
Me.ComboBox1.DropDown
End Sub

4- Done !