Find the best tutors and institutes for Microsoft Excel Training

Find Best Microsoft Excel Training classes

Please select a Category.

Please select a Locality.

No matching category found.

No matching Locality found.

Outside India?

VBA Function -

Using FORMAT Function in VBA we can modify the format of Numbers, Dates, Times & String.

Syntax: FORMAT(expression, format, [firstdayofweek], [firstweekofyear])

1. Formatting "Numbers" using FORMAT function in VBA

SUB Format_Numbers()

MsgBox format(8686836999, "####-###-###")

'Output: '8686-836-999'

MsgBox format(143.5, "#,##.00")

'Output: '143.50'

MsgBox format(1729.4, "Currency")

'Output: '$1,729.40'

MsgBox format(0.9156, "Percent")

'Output: '91.56%'

MsgBox format(1729.4, "Standard")

'Output: '1,729.40'

End Sub

2. Formatting "Dates" using FORMAT function in VBA

Sub FORMAT_Dates()

MsgBox format("3/21/2017", "Short Date")

'Output: '3/21/2017'

MsgBox format("3/21/2017", "Medium Date")

'Output: '21-Mar-17'

MsgBox format("3/21/2017", "Long Date")

'Output: 'Tuesday, March 21, 2017'

MsgBox format("3/21/2017", "mmm dd")

'Output: 'Mar 21'

End Sub

3. Formatting "Time" using FORMAT function in VBA

Sub FORMAT_Time()

MsgBox format("6:30:45", "Short Time")

'Output: '06:30'

MsgBox format("6:30:45", "LONG Time")

'Output: '6:30:45 AM'

MsgBox format("6:30:45", "MEDIUM Time")

'Output: '06:30 AM'

MsgBox format("14:30:45", "HH:MM")

'Output: '14:30'

End Sub

4. Formatting "Text" using FORMAT function in VBA

Sub FORMAT_Text()

MsgBox format("EXCEL IS MAGIC", "<")

'Output: 'excel is magic' (convert text to lower case)

MsgBox format("excel is magic", ">")

'Output: 'EXCEL IS MAGIC' (convert text to upper case)

End Sub

 

0 Dislike
Follow 0

Please Enter a comment

Submit

Other Lessons for You

Hidden Gems of MS Excel - Data Validation - Circle Invalid Data
Q) You apply Data Validation to a range of Cells. e.g. You apply Data Validation Drop-down List of 5 Indian Cities: Indore, Lucknow, Mumbai, New Delhi, Pune, to a range of Cells What if invalid data...

Ankur Sharma | 6 days ago

1 0
0

What is save workspace?
Its an option in excel that help you to save a shortcut in particular place (may be your desktop). When you double click to open this shortcut it opens all the related excel files together from different...

Krishanu P. | 23 Sep

0 0
0

HERE TODAY WE WILL USE THE SUMIFS FUNCTION.
A B C D 1 NAME PRODUCT NAME TOTAL AMOUNT 2 SAURABH WASHING MACHINE 4165 3 MANIPAL MI PHONE 4803 4 ANJALI SAMSUNG MOBILE 4610 5 UMA NOKIA PHONE 4441 6 SHANKER T.V 3765 7 NARESH ...

Saurabh Sharma | 20 Sep

0 0
0

Today WE LEARN a excel formula like UPPER FUNCTION
Here we are using upper case formula, these formula are used in advanced excel. A B C 1 Hansraj HANSRAJ =upper(TEXT) =UPPER(B1) 2 lakir LAKIR =UPPER(B2) 3 Seema SEEMA =UPPER(B3) 4 Mansi MANSI =UPPER(B4) 5 jyoti JYOTI =UPPER(B5) 6 mahima MAHIMA =UPPER(B6) 7 shashi SHASHI =UPPER(B7) ...

Saurabh Sharma | 16 Sep

0 0
0

TODAY WE LEARN MIN FORMULA, HOW TO USE IT.
1 A B 2 NAME MARKS 3 Vinita 50 4 Anjali 34 5 Mahima 73 6 Kartrina 18 7 Mahender 65 8 Silver 48 =min(B3:B8) ANSWER 18 =MIN(number 1, {number 2},...)

Saurabh Sharma | 14 Sep

0 0
0

Find Best Microsoft Excel Training classes?

Find Now »

UrbanPro.com is India's largest network of most trusted tutors and institutes. Over 25 lakh students rely on UrbanPro.com, to fulfill their learning requirements across 1,000+ categories. Using UrbanPro.com, parents, and students can compare multiple Tutors and Institutes and choose the one that best suits their requirements. More than 6.5 lakh verified Tutors and Institutes are helping millions of students every day and growing their tutoring business on UrbanPro.com. Whether you are looking for a tutor to learn mathematics, a German language trainer to brush up your German language skills or an institute to upgrade your IT skills, we have got the best selection of Tutors and Training Institutes for you. Read more