Excel / SQL - Accessing DB Where Values Of Column In Range

Oct 5, 2013

First I have a excel with a selection of customers:
Column A = customer id
Column B = customer name
...
this excel contains about 500 premium customers

Secondly, on an external server I have a database with the details (adress, phonenumber, ...) of about 100.000 customers

Now I would like to display the details from the database into the existing excel. For that I was about to write a sql-query to copy the data I need to have into the excel (sheet2) to access it from sheet 1 with vlookup (based on the customer id).

But the large amount of data makes excel to work very slowly and it is impossible to keep on working like that. So now I was looking for a way to create a selective sql-statement.

Something like this:
select details from db
where customerid in (all the customer id's mentioned in sheet 1)
without writing all customer id's manually

View 2 Replies


ADVERTISEMENT

Excel 2003 :: Adding Values If Column Next To It Is In Certain Range

Sep 9, 2013

I have this code working fine in excel 2007 but I need to get it working in excel 2003.

=0.02*(_xlfn.SUMIFS($D$2:$D$98,$C$2:$C$98,">="&I5,$C$2:$C$98,"<="&I4))

I have attached a test document to show what I'd like to do. It is basically adding values if the column next to it is in a certain range.

counting columns in Excel 2003.xls

View 3 Replies View Related

Accessing Values Of 'alphanumeric' Variables

Jan 3, 2010

I have declared a number of string variables named "hlpYear1", "hlpYear2" etc in the 'Worksheet_SelectionChange' function. "hlpYear1" contains the appropriate text to display if the selected language is English, "hlpYear2" is for French and so on. I was hoping that I would be able to use VBA to display the appropriate text by way of a 'For..Next' statement along the following lines:

View 4 Replies View Related

Accessing Bank Balances Automatically With Excel?

May 31, 2014

Is it possible to have my Excel cash flow sheet access my bank checking account and automatically update with my current balance?

View 1 Replies View Related

Accessing Multiple Excel Grids With A Program Or Code

May 28, 2014

I am currently looking for a front end program to access multiple excel files at once. In a nutshell, I work for a company that uses subcontractors. Each subcontractor is graded in about 7 different performance categories. I receive daily excel files that give us the results for each category. I get separate files for each category.

What I do right now is use a master excel file. Every day I take each file I receive from our parent company and add it to the master file. I have a huge excel file that has a separate tab for each performance category. Then I have a "Report" tab where I use various formulas to summarize a sub's performance over a certain date range.

Essentially, the report tab is just a neat and concise way to display the stats of an individual sub, an office, a region or the whole company. I use tons of VLOOKUP and COUNTIF(S) formulas to look over the hundreds of lines of data and bring back the stats. It works but it is just not very efficient as I get hundreds of new lines of data every day.

View 4 Replies View Related

Excel 2010 :: Accessing VBA Module From UserForm On Workbook Open

Feb 13, 2013

I am using Excel 2010 and late binding to generate reports. The sheets are blank and unused. I have the UserForm being opened on Workbook_Open and the actual VBA for doing the work in a separate macro in the workbook. All the posts I have found are dealing with accessing cells from the UserForm and I haven't found any dealing with connecting a macro to the UserForm output.

My question is this: I want to return from the UserForm the flags of which reports to run to the (unopened) macro containing the code to do so. How do I open the macro and pass the variables to it?

The UserForm is creatively called "SelectionForm" and the macro is called "DailyFTP" with a Main sub as the entry. I know I can use the code under to capture the radio button and checkbox choices. I have other variables like the names of files set as global variables in the DailyFTP macro. The macro doesn't exist until SelectionForm opens it, so they must be set after the macro is in memory.

View 6 Replies View Related

Macro Loop To Extract Specific Values And Min/Max Values From Column/Rows Range

Jun 3, 2009

Hi, I'm very new to writing Excel Macro's and wanted to know if I could do the following. Conceptually, I understand what I need done and think it should be fairly straightforward.

There's 2 main events in this loop (I hope that's the correct terminology):

Input 1) User defines the beginning cell to start the loop. In this case, A2.

Input 2) User defines the range of columns/rows to display. The formula for rows that I've thought of is 4r. So if a user wants 20 rows below cells A2, they simply input 5 for r. The number of columns is a constant 5. So if r=5, then I'd want the range to be A2:E22......

View 13 Replies View Related

Prevent User From Accessing The Excel File When It Is In Use By Another User

Jul 22, 2013

An Excel file named CLEARING is availble in thr central server system. it will be accessed by 5 or 6 staffs from some other systems what i need is when one person accesses/edits this file the others should not even able to open in the read only file ,when the file is saved and closed ,then only the next person should access it

View 1 Replies View Related

Function To Sort A Range By The Values In A Specific Column And Return The Range

Mar 25, 2009

I was just recently forced to create my first UDF and after how well it worked I now am very interested in learning more. I am trying to create a function to sort a range by the values in a specific column and return the range. I know this should be really simple but for some reason my code dies whenever it gets to my inner-most loop. I need to use this in a larger function but for now this is my only question. I did find that Excel 2007 has built in Functions for this but my company still uses 2003.

My
Public Function SortRange(rngToSort As Range, valCol As Integer)
Dim Swapper As Variant
Dim i As Integer, _
j As Integer, _
k As Integer

For i = 1 To rngToSort.Rows.Count
For j = 1 To rngToSort.Rows.Count - i
If rngToSort(j + 1, valCol) < rngToSort(j, valCol) Then
For k = 1 To rngToSort.Columns.Count
Swapper = rngToSort(j, k)
rngToSort(j, k) = rngToSort(j + 1, k)
rngToSort(j + 1, k) = Swapper
Next k
End If
Next j
Next i
SortRange = rngToSort
End Function

View 9 Replies View Related

Excel 2010 :: Count Distinct Text Values In One Column If Another Column Equals A Value

Mar 5, 2014

I am trying to count the distinct times a value shows up in a column, if another column has a 2 in it.

For example:
Columns
A, B
2,P25
2,P25
3,P5
3,P6
2,P5

The results shoud be: (2) Because I only want to count the P25 one time.

I'm using Excel 2010

View 2 Replies View Related

Excel 2013 :: Formula To Subtract 7th Column Values From Column Before 1st Loop?

Feb 21, 2014

I have a code that inserts a new column after every 7th column. I want to include a formula where every 7th column value is subtracted from the values present in the column before the 1st, or you can think of it as subtracting 7th column of the present group from the 7th column of the previous group. Example: The range of my data starts from col F, then

F (7th) New Column (G) H (1st) I (2nd) J (3rd) K (4th) L (5th) M (6th) N (7th) New Column (O) P (1st) Q (2nd) R (3rd)

So, New Column (O) = N - F
and the next New Column (W) = V-N ...

NOTE: Column G can be ignored.

I want to add a looping function to this so that it will continue to subtract for the other respective columns as well. How do I incorporate this into the following code?

[Code].....

I'm using Excel 2013.

View 2 Replies View Related

Excel 2007 :: Autofill Column B With Sequential Values Based On Value In Column A

Nov 27, 2011

Autofill column B with sequential values based on whether value in column A changes its value.

I would like to autofill column 'B' with sequential values (i.e. GenoMap1, Genomap2, Genomap3,... GenoMap10, GenoMap11, GenoMap12,... GenoMap104, GenoMap105, etc...), but changing to the sequential GenoMap# only when the value in column A changes.

This is what I imagine.

A1 "Alfiero", B1 "GenoMap1"
A2 "Alfiero", B2 "GenoMap1"
A3 "Alfiero", B3 "GenoMap1"
A4 "Allocati", B4 "GenoMap2"
A5 "Amaranto", B5 "GenoMap3"
A6 "Amaranto", B6 "GenoMap3"
A7 "Amaranto", B7 "GenoMap3"
A8 "Ambrosiano", B8 "GenoMap4"
A9 "Ambrosiano", B9 "GenoMap4"
A10 "Ambrosiano", B10 "GenoMap4"
A11 "Ambrosiano", B11 "GenoMap4"

I listed examples above of GenoMaps higher than 10 and 100 to show how I need them numbered.

I'm using MS Excel 2007 in Windows 7.

View 2 Replies View Related

Build Range From Column And Row Values

Apr 24, 2008

I'm trying to copy a pivot table cell onto another worksheet that has a table with Month-Dates across the top in columns and left-most column has several cells, each with a named range. I get an application error with:

Sheets(shtSrc).rngSrc.Address.Copy _
Sheets(shtDest).Range(Sheets(shtDest).Range(rngDest).Row, Dt.Column)
shtSrc and shtDest are Strings passed in to Sub for worksheet name.
rngSrc is a Range passed in to Sub.
rngDest is the Named Range of the destination cell.

All of the values get passed in; I'm just not using the range properly I think.

I'm not married to what I've got so far. Basically, as long as the pivot data gets copied at the intersection of the correct Date (Column) and Row I'll be happy.

View 9 Replies View Related

Save As PDF Using Cell Range Values (excel Vba)

Jan 31, 2013

I would like to export data coming from a range values which I set up. Just like the code below that will print out all the data using range values. I would like also to do the same in exporting the data in one pdf file with multiple pages based on each of the data of the range.

VB:
Sub Batch_Print()
Dim FileName As String
' On Error GoTo Print_all_Error

[Code].....

View 1 Replies View Related

Excel 2007 :: Sum Values From Set Range In 4 Different Files?

Jan 16, 2012

I have 4 different excel files in C:Reports (SupplierA.xls, SupplierB.xls, SupplierC.xls and SupplierD.xls) all with a page called "Summary" (like below) in a set range A2:F5.

Fruit
Monday
Tuesday
Wednesday
Thursday
Friday
Apples
2 4 1 7 8 Oranges
2 3 4 6 9 Lemons
4 5 6 6 6 Pears
1 2 3 5 5

I also have a summary excel file in C:Totals called "Supplier Totals" that has a summary page that I want to total up all my suppliers A, B, C and D (same as above A2:F2). How can do this in VBA?

I am using Excel 2007.

View 1 Replies View Related

Compare Values In Range Of Columns In Excel VBA

Jul 10, 2013

So I have values in Column L3 to AH3 and I would like to use if condition to see which values are less than 10.

I also have other rows where this comparison needs to be done but for now I can't even get simple if condition to work.

this is what I am doing

For Each cell In Range("L3:AH3")
If cell.Value < 10 Then
ActiveCell.Font.Color = vbRed
End If
Next cell

I am not getting any error but for some reason only first cell condition is compared and not the other cells..

View 2 Replies View Related

Check Instances Of A Range Of Values In A Column

Sep 30, 2008

I have a column that I want to check if a column contains any instances of particular values. If any are present I want it to return a 1, if not then return a zero.

View 11 Replies View Related

VBA Loop Range And Insert Values In New Column?

Mar 21, 2014

I built a Microsoft Access database for my church to track member information. I was able to import a lot of the needed information to create the records for each individual and household easily. What I can't do is import their offering donations until it is "Normalized." Which means that I need each row to be 1 record with the fields listed as the column headings. My church has a spreadsheet with several sheets one of which is named Input. I've attached the desensitized file for you to view/play with.

What I need to do is loop through the input sheet and find all the values in range B:4 to GN:387 that are greater than zero or not null (I believe they entered the default as zero so their other calculations would work). Then I need those values to be transferred to the column labeled Offering Amount on the ImporttoAccess sheet. Somehow I also need to define three variables associated with the cell that is contains a value greater than zero.

1. I need the row heading value for the envelope number (Column A of input sheet) which intersects with the amount

2. I need the column heading value (3 field merged) for the date (Row 1 of input sheet) which intersects with the amount

3. I need the column heading value (labeled: GenFund, WLA, or Missions) for the designation of the offering (Row 2 of input sheet) which intersects with the amount

Each of these I need to attach to the value offering amount and insert into their corresponding column fields for that record. I have entered 2 example rows of data into the ImporttoAccess sheet for you to see what I am after. I am sure it's possible since the data is there, But how to go about it.

View 4 Replies View Related

Selecting The 2 Last Values In A Column Of Data With Range

Jan 23, 2007

I m trying to make a button to add values to another sheet in my xls. Ive done that... now i try to autofill the percentages from left and above one row....

View 9 Replies View Related

Excel VBA To Sum Column Based On Values In Two Other Columns

Jul 9, 2014

I have successfully populated a website forms using Excel VBA. As a continuation of this task, i need to calculate the total of a column based on two other columns in the same worksheet.

Column A contains Date, column B contains 3 fixed alphabets (I, L and K) and column C contains time. I have attached a sample sheet here. sample.xls

How can i write a VBA code to find the sum of effort values of column C for each values in column B for a given date (value in column A).

View 9 Replies View Related

Find Top Equivalent Values In Excel Range Without Sorting?

Mar 29, 2014

I know the formula =large but my problem is the formula for the equivalent value for it. Note: In my xcel file attached you can see there are multiple items with the same total numbers and also blanks

View 3 Replies View Related

Multiply Column Of Values By A Random Number Within Range?

Apr 20, 2012

I have a column of values I need to multiply by a random number (percentage) within a range of numbers (15%-22%).

How can this be done?

View 1 Replies View Related

Copy And Replace Duplicate Values In Column Range?

Sep 18, 2012

I have following code (see below) which finds the duplicates within columns, but I require copying and replacing duplicate values within different row cells, as I am currently finding this task hard to implement.

Input Data example:
Name
Short_code
Lng_code

[Code]....

View 9 Replies View Related

Create Named Range Based On Column Values

Dec 30, 2007

I have a worksheet that has hourly data. So Column C of this worksheet looks like

1
1
1
1
2
2
2
3
3
3
3
3
3

What I want to do is, given an hour h, automatically create a named range that contains all the rows such that the value of Column C is equal to h.

View 9 Replies View Related

Copy & Insert Range If Column Values Match

Mar 24, 2008

I have another little VBA macro problem that appears to be beyond my coding knowledge.

I have attached a small excel spreadsheet, with a macro recorded (CTRL-P) of what I'm trying to accomplish. Basically, If the data in column A matches a single entry in column F, I need to copy and insert the row (columns F-L) that matches.

View 4 Replies View Related

Excel 2013 :: Populating Column Without Duplicate Values

Jul 14, 2014

I've got a column of client company names and because it is based from accounts, the companies names appear many times. I just need to populate a new column with unique names, so I have found a formula to do this:

=INDEX($A$2:$A$20, MATCH(0, COUNTIF($B$1:B1, $A$2:$A$20), 0))

However when I do this, I CtrlShiftEnter and drag to copy that down, and it's just a copy of the original list - client names are appearing on my new list multiple times. I don't see how this doesn't work... I'm using 2013.

View 1 Replies View Related

Excel 2013 :: Averaging Values Of Rows From Particular Column

Aug 6, 2014

Is it possible to perform average function on subsequent group of rows and make a new set of rows ?

For example: As below, in column 1 the average of values of first 3 rows (i.e, 1, 2 & 3) is 2. similarly average of values in next 3 rows (i.e, 4,5 & 6) is 5 and so on....

Is this possible to get a new set of rows by averaging values of rows from a particular column. without applying average formula in each row of column 2. i m using MS Excel 13.

Column 1 ______ Column 2
1 _____________ 2
2 ______________ 5
3 ______________ 8
4 _____________ 11
5
6
7
8
9
10
11
12

View 4 Replies View Related

Excel 2003 :: Finding 3rd / 2nd And Highest Values In A Column?

Mar 7, 2013

I have a spreadsheet and on sheet 1 it currently has 45791 rows filled with data and it increases each day.

Each row looks like this

A RACECOURSE
B DATE
C RACE DETAILS
D HORSES NAME
E RATING OF THE HORSE

On Sheet 2 I have 3 columns. These are the list of horses that are running on a particular day.

A DATE
B RACECOURSE
C NAME OF RACEHORSE

What I want to do is to be able to list in columns D,E,and F on sheet 2 the last three ratings the horses achieved from sheet 1.

how to acquire the latest rating of the horse by using the following formula.

=IF(ISNUMBER(v(LOOKUP(9.9999999999999E+307,1/SEARCH(C2,Sheet1!$D$3:$D$45790),Sheet1!$E$3:$E$45790))),v(),"")

This works a treat but for the life of me I can't fathom out how to get the formula to pick the latest three ratings and place them on sheet 2.

I am using excel 2003

View 9 Replies View Related

Adding Items To Array From And Excel Range Based On Values?

Oct 2, 2012

On this is a column of Categories and a Column of sizes. I want to use these in a user form. The user will select their Category from a drop down list and the second drop down list will include only the sizes that appear next to the chosen category So for example in the attachment if the user chose 'AUD' as a category they would get the size choices of, '2x4 insert', '2x4 replica' and 'A4L' in the other drop down menu.

The master list of sizes will have to remain on a worksheet as this is what other operators will amend from time to time.

View 1 Replies View Related

Excel 2003 :: Average Of Cells Which Are Not In Range Which Ignores Any Zero Values

Dec 4, 2013

I have a worksheet which has various figures for each day of the week however I need to establish the weekly average of these figures.

Due to the way in which the figures are displayed, I am unsure how to use a formula which does not require a range with cells located adjacent to one another.

I have attached a test sheet as an example. The cells in yellow require the formula and I need a weekly average for criteria 1-3. This formula also needs to be compatible in Excel 2003

Test Sheet.xls

View 3 Replies View Related







Copyrights 2005-15 www.BigResource.com, All rights reserved