Showing posts with label database. Show all posts
Showing posts with label database. Show all posts

Friday, February 26, 2016

Video example: export html files from an EXCEL database using custom templates

This video shows an example of a program made in EXCEl / VBA that exports html files in a chosen directory from an Excel database: one file per row of data. The template file is customizable.



Full version:



Created by DoMyExcel.com © | Excel & VBA Consulting | Customized Excel Solutions starting at 29 USD
Services provided to Individuals and Businesses | Free Quote: DoMyExcel@gmail.com

Saturday, March 29, 2014

Video example of a VBA user interface to sort and color code a database

Excel Macro example: Sorting a database

- Format automatically a database
- Add sorting options 
- Organize by columns
- Add Macro call out Button
 - Friendly user interface 
- Data sorting by colors
- Simple controls to interact with database 
- Multi criteria sorting
- Export file on desktop




Tuesday, March 25, 2014

How to organize your data in Excel to make a pivot table

How to organize your data to easily create a consistent pivot chart

The easiest way to organize your data if you want to use the powerful tool of pivot chart in Excel is to work by columns with titles on first row, such as the example below:
 
Example: Planning / tracking of an entertainment company. The company tracks the number of ticket sold depending of the type of event (show / concert), the location of the event (main stage / second stage) and by date.
 

1) Organization of data base

Instead of presenting the database like this for example:
 
 
Pick up the different variables of the spreadsheet (type of event, location, number of ticket sold, date) and organize the database by columns, with the titles of the different variables in first row:
 
 

2) Pivot chart creation

Simply select the entire table and click on "Pivot Chart" (Menu "Insert").
 
 
Then locate the cell you want the pivot table to be created (Note that a pivot chart is always based on a pivot table).
 

3) Set up of the pivot chart

Example 1: Display the sum of tickets sold by type of event:
 
 
 
 
Example 2: Display the sum of tickets sold by stage and by type of event: 
 
 

Sunday, March 16, 2014

How to lookup a specific word or value in a cell or an Excel database using the VBA function Instr()

Four examples to understand the function Instr() on VBA:


Example 1: Instr() return the position of a character in a word

Sub function_instr()
'Instr syntax: InStr( [start], string, substring, [compare] )
'VBA Excel search the position of a character in a word - integer
'ex 1: check at what position is the letter x contained in word "domyexcel.com"

result_ex1 = InStr("domyexcel.com", "x")
MsgBox ("character x is at the " & result_ex1 & "th position in the world domyexcel.com")

End sub

Example 2: Instr() presence of a character in a word (True or False)

Sub function_instr()
'VBA Excel check if a letter is included in a word - true or false
'ex 2: check if yes or no the letter x contained in word "domyexcel.com"

If InStr("domyexcel.com", "x") > 0 Then
result_ex2 = True
MsgBox ("letter x is included in domyexcel.com")
Else
result_ex2 = False
MsgBox ("letter x is not included in domyexcel.com")
End If

End Sub

Example 3: Instr() presence and location of a word in a database

Sub function_instr()
'VBA Excel search if a world is contained in a database:
'ex3: tell at which line of the database the world "domyexcel" was found

For i = 1 To 10
    If InStr(Cells(i, 1), "domyexcel.com") > 0 Then
    result_ex3 = i
    MsgBox ("The word domyexcel.com was found at row " & result_ex3)
    End If
Next

End Sub

Example 4: Instr() Highlight the cell in a database that contain a specific character or word

Sub function_instr()
'VBA Excel highlight the cells in a database that contained a specific word a/o character
'ex4: highlight in blue the cells that contain the character x

For i = 1 To 10
    If InStr(Cells(i, 4), "x") > 0 Then
    Cells(i, 4).Select
    Selection.Interior.Color = 16750899
    End If
Next

End Sub


Code syntax: charles.racaud.free.fr