Aug 06 2019 04:19 PM - edited Aug 07 2019 10:25 AM
Hello,
I am a fairly new excel user on mac,
I receive monthly reports that all have the same format(but are not in a table).
I wanted to set up a data frame to automatically collect and store important data from these reports into a clean table.
I am able to copy these reports into one excel file as separate worksheets,
but I am unable to set up a system that would fill out each row with data from each worksheet(individual report).
Do you have any suggestions on how to set up this up?
or idea on better ways to set up a dataframe?
As suggested by @Kodipady I have attached a sample report along with a rough draft of the data frame.
Thanks in advance!
Aug 07 2019 04:33 AM
If you could upload your worksheet with some sample and realistic test data, that will help you get a much quicker response.
Aug 07 2019 10:24 AM
Thank you for the suggestion!
I have upload a sample report and a very rough draft of what I imagine my database should look like.
Aug 09 2019 08:58 AM
SolutionI updated few cells in the data frame tab with a possible solution( which is only partial solution). I am assuming that you will have one row per month in Dataframe. if yes, you can update the first column "sheet name" - this is the tab where you will extract data. the cell references need to be updated in the formule in B2, C2, D2 etc (first row). for example for country i assumed that L3 cell in 2019JUN tab is the source, hence the formula in B2 is =IFERROR(INDIRECT($A2&"!L3"),"")
to complete this, you will have to populate the 1st row, with formula like in B2 and C2, then copy /paste these formula to the next rows. of course, the first column "sheet name" needs to be updated as well.
hope it helps !!
Aug 09 2019 09:47 AM - edited Aug 09 2019 09:48 AM
@Kodipady Thank you so much!
This is a very elegant solution, and a useful tool to have!
Yesterday, I had written a VBA to accomplished a similar task, but this method is easier
and more convenient.
Thanks!
Here is what I did with the VBA.
I created a Variable input for the sheet name, and made the macros
copy the data onto the next open line.
Private Sub Plugdata()
'#Define Variables
Dim Reportname As String, Country As String, Year As Integer, Month As String, Regular_EMP As Integer
Reportname = InputBox("Type the Report Name eg. 2017Jan", "Type Report Name", "Type Report Name Here")
Worksheets(Reportname).Select
Country = Range("L3")
Year = Range("H1")
Month = Range("G1")
Regular_EMP = Range("D10")
'#Select Paste Location
Worksheets("Data").Select
Worksheets("Data").Range("A1").Select
If Worksheets("Data").Range("A1").Offset(1, 0) <> "" Then
Worksheets("Data").Range("A1").End(xlDown).Select
End If
'#Enter Data
ActiveCell.Offset(1, 0).Select
ActiveCell.Value = Country
ActiveCell.Offset(0, 1).Select
ActiveCell.Value = Year
ActiveCell.Offset(0, 1).Select
ActiveCell.Value = Month
ActiveCell.Offset(0, 1).Select
ActiveCell.Value = Regular_EMP
End Sub
Aug 09 2019 10:17 AM
@Kodipady I was wondering, is there a way to extract data from a cell that's not always in the same location?
For example, in the Sample report, the Expenditure can be found in D138, with the word "Expenditure" written right about it in D137. However, some reports come back with extra lines added above, which moves the Expenditure to D1XX (e.g. D143).
Once again, thank you for your help!
Aug 11 2019 11:29 PM - edited Aug 11 2019 11:30 PM
The following formula matches "Expenditure" in column D. If it finds a match, returns the value in the next row after it finds the first occurance of "Expenditure".
=INDEX( 2019JUN!D:D, MATCH("Expenditure",2019JUN!D:D)+1)
This removes the hardcoding of Expenditure cell.
Aug 12 2019 02:42 PM
I've been looking all over for a formula like this.
Would it be possible to combine this with the previous formula to create a formula that can be adapted to various worksheets named in column A?
Aug 12 2019 07:38 PM
following is a combination of two.
=INDEX( INDIRECT($A2&"!D:D"), MATCH("Expenditure",INDIRECT($A2&"!D:D"))+1)
This is for Expenditure. For other columns, you need to define similar rules (such as the row below "Total Sponsonship" in column D:D).
Aug 14 2019 03:57 PM
@Kodipady This is awesome! I will try using this to finish the database!
I will let you know how it goes.
Thank you!
Aug 09 2019 08:58 AM
SolutionI updated few cells in the data frame tab with a possible solution( which is only partial solution). I am assuming that you will have one row per month in Dataframe. if yes, you can update the first column "sheet name" - this is the tab where you will extract data. the cell references need to be updated in the formule in B2, C2, D2 etc (first row). for example for country i assumed that L3 cell in 2019JUN tab is the source, hence the formula in B2 is =IFERROR(INDIRECT($A2&"!L3"),"")
to complete this, you will have to populate the 1st row, with formula like in B2 and C2, then copy /paste these formula to the next rows. of course, the first column "sheet name" needs to be updated as well.
hope it helps !!