Lookup Functions After Adding New Worksheet To Workbook

Dec 10, 2013

What I would like to do is have a master workbook that I can import different .csv files into as a new worksheet. Then calculations will be run on the values that are imported. My goal is to select a column and have corresponding list update the values. After that formulas will run on the calculations. I have got the import csv file down using VBA. The problem I was running into was with the Data Validation. Since I was overwriting my existing sheet I would get a #REF error because the link was broken. So I have worked my way around this for the list using the OFFSETSHEET Function:

VB:
Function SHEETOFFSET(offset, Ref)
[COLOR=#0000ff] ' Returns cell contents at Ref, in sheet offset[/COLOR]
Application.Volatile
With Application.Caller.Parent
SHEETOFFSET = .Parent.Sheets(.Index + offset) _
.Range(Ref.Address).Value
End With
End Function

This returns a value to a row in my mater sheet and I reference this for the data validation list.

However, I get the same problem when working with the HLookup function, the #REF error occurs. So far the only way I have figured out to work around this is to create another sheet that dynamically updates its values using the same OFFSETSHEET function, and my master sheet then references it.

View 8 Replies


ADVERTISEMENT

Nest Lookup With IF AND Functions

Jan 29, 2008

I have a spreadsheet that is by:

Purchase Date (column A)
Sales Date(column B)
Quantity(column C)
Name (column D)
Gain/loss (column E)

The spreadsheet is sorted by name in ascending order and also by quantity in ascending order.

Assuming row 1 is the heading. If D2 (name)= the same as another D cell and it's quantity i.e. C2 is negative, while the other D cell with the same name as D2 has a positive quantity i.e. corresponding C cell, and if the date in B2 is greater than date in column A of the other cell where it's D cell matches D2 and has a positive quantity, then in I would like "possible" to display in F2.

I have included an attachment to better illustrate what I have described above, because I am not sure if I am clear enough.

View 9 Replies View Related

Multiple Criteria Lookup Functions?

Aug 6, 2014

I've attached a sample of the data I'm using.

I have two spreadsheets (the samples for which I have shown side by side in Sheet 1 of the attached file).

Spreadsheet 1 is about 30,000 rows and too large for me to change the formatting and structure.

Spreadsheet 2 is the output I need and the format is required by other stakeholders.

In spreadsheet 1 I want to sum quantity in stock for Type 1, Type 2 and Type 3 for each product and allocate it to spreadsheet 2 according to the month in which the product expires. For example, there will be a total of 92 units of product 413302 which will expire in Nov, 2014. Therefore I want 92 to be placed in cell N6 of Spreadsheet 2.

Unfortunately the product number is not unique - there are multiple sub products in spreadsheet 1 but they all have the same quantities of stock. The sub products are referenced in other parts of the report so I can't consolidate by Product Number. This also prevents me from using the SUMIFS function as it will duplicate the number found in the sub products.

What I need, perhaps in a combination of functions, is to find the first instance of product 413302 in Spreadsheet 1 that is expiring in Nov 14, sum the product types and give the result in cell N6 of Spreadsheet 2.

View 3 Replies View Related

Lookup Functions For A Range Of Cells

Jan 30, 2010

I have a table in one sheet as follows: .....

View 9 Replies View Related

Lookup Functions & Data Arrangement

Apr 21, 2006

I'm at an impass and need some help please. I'm trying to create a spreadsheet that will look up UNSORTED data in Column A and return the value of the corresponding Row data in the adjacent column. Can this be done? It is my understanding that LOOKUP functions only work with sorted, ascending data, but this is not possible with the data I'm trying to analyze.

(eg. COLUMN A - contains unsorted list of names
COLUMN B - contains numbers indicating skill level of the person in the next column

I need the formula to look at column A, pick out "Joe Smith" and return the number value from COLUMN B)

View 3 Replies View Related

Replace Multiple If Functions With Lookup

Oct 16, 2007

I have multiple IF functions in a formula and found out that the maximum allowed is 7 and should use Lookup instead. The formula is to calculate the Present Value of an amount with the corresponding interest rates and number of days left.

View 3 Replies View Related

Lookup Functions Omit Line Breaks?

Mar 3, 2013

Is there a lookup function available that keeps the line breaks in from the lookup array? As shown in the example the Vlookup omits them, I have also tried with Index/Match, but its the same story.

View 3 Replies View Related

Combine Or Nest Multiple Lookup Functions

Dec 16, 2006

I've got an indexmatch that works great
=IF(ISERROR(INDEX(accountstaff,MATCH(B$20,INDEX(accountstaff,,1),0),MATCH($ A55,INDEX(accountstaff,1,),0))),0,INDEX(accountstaff,MATCH(B$20,INDEX(accou ntstaff,,1),0),MATCH($A55,INDEX(accountstaff,1,),0)))

But I need to incorporate IF statement based on varying levels of revenue and think VBA will be less cumbersome, but don't know how to combine else if and index match.

I am trying to accomplish this:
IF B$20 (which is a dollar amount is = X, then index, match....
IF B$20 is > Y but < Z, then index, match...

View 9 Replies View Related

Find The Commission Rate Per Worker Using Lookup Functions

Dec 24, 2005

I have a sheet listing comission rate eg. sales less than $200, the rate is
..5%, less than 300, the rate is 1%..etc.

Then i have another table showing different sales value of different workers. How do i find the commission rate per worker using lookup functions??

View 12 Replies View Related

Lookup Functions Find The Address Of The Minimum Value In That Range

Sep 19, 2009

I have a range of cells (say A1:D8).
I wanna find the address (say $B$2) of the minimum value in that range.


This command does it but it only works on a column. it does not accept a range spanning more than one column.
=CELL("address",INDEX(B2:B7,MATCH(MIN(B2:B7),B2:B7,0)))
this will tell me the address of the minimum value.. but in a column... I need a range of many columns.

So I tried converting things to a Table.. but it never worked. basically the MATCH command is my problem. It only accepts single-column-ed ranges.

View 13 Replies View Related

Run Functions From Another Workbook

Aug 3, 2006

How can I execute a function that exists in workbook "A.xls" from VBA code in workbook "B.xls"?

Something like:
' -------- Code in workbook "B.xls"
Workbooks("A.xls")!My_Function(param 1, param 2)

View 3 Replies View Related

Worksheet Functions In VBA

Jan 15, 2007

Is possible to pass names into a worksheet function and whether values from other sheets are able to be passed in, eg i am trying to paste this function into the work sheet to find the left two characters of a certain string. However the string position varies:

= left(worksheet name! row(1) column.range("startno"),2

View 10 Replies View Related

Prevent VBA Functions From Being Available On Worksheet

Jul 9, 2014

I use a few Functions in my VBA code. All these functions, are declared as "Public", and reside in a single module. However, they are called from many different modules during code execution. (i.e. many functions called from many modules - hence the "Public" declaration).

My issue is that in addition to being available to different VBA Modules, these Functions are also available on the worksheet as a UDF (so if a user presses "=" in the formula bar, the auto-complete shows these functions when the first characters match). Is there a way to remove the availability of the function on user worksheet? i.e. to allow a Function to be called from different modules in VBA, but prevent it from being available on the worksheet.

My current work-around is to prefix all Public Function names with letter "j" - as no excel formula seems to begin with it - none of them show up as auto-complete options. Nevertheless, the Functions are still available to the user - which is what I would like to prevent.

View 9 Replies View Related

Worksheet Functions In Macros

Aug 2, 2009

I've been reading about usage of worksheet functions in macros, and I guess I'm still not getting it. What I want to do, is use Countif and Indirect worksheet functions in a macro but it always fails. Here is my formula

IF(Worksheetfunction.Countif(Worksheetfunction.INDIRECT("[DaysWorking.xls]'Collect No Stats'!$A:$A"),'2009'!Range("D" & x))>0)

Basically, I want to see if 2 different cells in 2 different workbooks match and then I would use the information to write different info in another cell. X is just a variable in a DO WHILE LOOP. Can these functions be used in a macro? Is there an alternative?

View 3 Replies View Related

Conditional Functions In Worksheet

Aug 4, 2009

I have an excel problem with formula. I’m not sure of the formula I think its sumif but don’t know how to express the criteria . I am trying to create a spreadsheet that will total the data from Colum B, C & D. I have 3 columns with the following data.

Column B Heading Length
Column C Heading Width
Column D Heading Depth

Column E Heading LM (lineal meters) will have the data only from column B. Column F Heading M2 will equal the data of column B & C (remembering the math is M2 = column B x Column C. Column G Heading M3 will equal the data of Column B, C & D (remembering the math is M3 = column B x Column C x Column D. That’s the easy part but in columns H to J, I have other headings and column K is my Rate.

Column L is my subtotal and this is where my problem lies, because the formula is =SUM(E1:J1)*K1 it has the potential to double up on figures when I use the dropdown formula for Columns E,F, and G all data is carried down with them. I want Column E to show only the value, if column B has a number and Columns C & D are empty. I want Column F to show only the value, if columns B & C have a number and Column D is empty. I want Column G to show on the value, if all columns have a number. If all these conditions are met, then only a value will be displayed in either column E, F, G Remembering that the values returned must be multiplied by the value of each number in the columns.

View 3 Replies View Related

Use Worksheet Functions In The VBA Code

May 16, 2006

How do I use excel functions in VBA code.

For example I do I use the max function which, gives the maximum value
from a range.

View 4 Replies View Related

Copy A Workbook Functions From Addin

Mar 29, 2009

I have a addin and I ahve some code wriiten in the Workbook_BeforeClose event. On click some "Copy Sheets" menu option in my addin it creates a new workbook and copies some sheets from the addin to the new workbook.

But I want somehow have the code written in Workbook_BeforeClose event of my addin to be copied too...Since I am coping only the sheets , workbook events are not copied.

View 2 Replies View Related

Activate Windows Or Workbook Functions

Jul 22, 2009

I have .xls files (ex: a.xls, b.xls etc) in a shared drive.How do I get information (run macros without changing anything) from a.xls and create a new file in my hard drive without opening a.xls. I don’t know if that is possible to do. May be sounds very weird. For example, I name this file on my hard drive as a01.xls, b01.xls from b.xls. Now I run other macros from a01.xls. which is active. I want this macros to run independent of the file name the user creates. In otherwords the workbook has to be variable. Not sure how to use ‘Thisworkbook’ function if that is what is needed to do.

View 12 Replies View Related

How To Disable Worksheet Functions Within Out Protection

Jun 19, 2009

I have a spreadsheet which has extra worksheets at the end that the user can move around, if they need them.

Then i found out that users were adding there own sheets, so i protected the workbook, but i found out that this stops the user from moving the sheet.

Whats the easiest way probably using code to disable the worksheet functions, ie the ones that appear if you click on the tab (insert,delete,rename,move+copy,select all sheets etc) but still allow the user to move the sheet within the workbook

View 7 Replies View Related

Index And Match Worksheet Functions

Aug 29, 2009

I am learning to use the index and match worksheet functions.

I read through some examples and tried to set up a spreadsheet as attached.

For some reason, it is working only partially. For some cells the value is returning correctly and in some it is returing #ref.

View 2 Replies View Related

Multiple Worksheet Change Functions

Jun 23, 2009

I have a spreadsheet using Data Validation to offer a list of text values for cells in the range E6 - E100. I have a worksheet change funtion to change the colour of the entire row based on the text chosen from the list.

What I would like to add is an input box that will appear when the value in the cell = "COMPLETE" asking for a completion date and adding the inputted date to the cell in column I in the same row.

Existing Worksheet Change Code;

Private Sub Worksheet_Change(ByVal Target As Range)
'Colour code rows based on order status
Dim rng As Range, i As Long
Dim cell As Range, Answers As Variant
Dim Colors As Variant
Colors = Array(24, 15, 38, 44, 42, 20, 36)
Answers = Array("CLOSED", "SUSPENDED", _
"COMPLETE - Awaiting Inspection", "COMPLETE", "WORKING", _
"SCHEDULED", "READY")
Set rng = Range("E6:E100")
rng.EntireRow.Interior.ColorIndex = xlNone
For Each cell In rng
For i = LBound(Answers) To UBound(Answers)
If LCase(cell) = LCase(Answers(i)) Then
cell.EntireRow.Interior.ColorIndex = Colors(i)
Exit For
End If
Next i
Next cell
End Sub

View 9 Replies View Related

Delay Calculation Of Worksheet Functions

Nov 9, 2006

I have a workbook that has many simple functions moving data around to different sheets and processing some if statements on some of the data. The problem that I am running into is all of the data is initially pulled in from a SQL DB, and I believe that the workbook is calculating many of it's if statements, prior to all of the SQL data being loaded, therefore, many of the worksheet formulas are coming up with the wrong result. Is there a way to delay the calculation of all the basic worksheet functions, so that I can ensure that all the data is in the workbook from SQL, before they all fire. I have attempted to use Tools--Options--Calculation--Manual Calculation, but it appears that even though I have things set that way, all of the formulas in the workbook have already pulled their values through.

View 2 Replies View Related

Lookup And Adding Cells

Jun 28, 2008

I have three columns.

For instance, Column A are names. Column B are totals points and Column C is year.

I want to a cell too look up all names of "John" for the year 2007, then with those two conditions add up all total points for John in 2007.

View 9 Replies View Related

Performing Worksheet Functions On One Column Of A Two Dimensional Array?

Nov 19, 2009

I have an array with dimensions (5000,30). I want to perform a worksheet function "Percentile" on specific columns within the array. So for instance I may want to know the element falling at the 50th percentile in column 5 of the 30 column array. Is there a way to do this without having to place the array onto a worksheet?

View 4 Replies View Related

Copy Worksheet In Workbook With All Formulas On New Worksheet Referencing Previous Worksheet

Apr 21, 2012

I have a workbook that contains 50 worksheets named 1-50. I need to add more worksheets. all the formulas in the worksheets always refers to the previous worksheet.

How can i make a copy of the worksheet named 50, name it 51 and have all the formulas in worksheet 51 refer back to worksheet 50?

View 1 Replies View Related

Copy A Worksheet Of Information In One Workbook To A Worksheet In Another Workbook

Mar 23, 2009

I have code that i use to copy a worksheet of information in one workbook to a worksheet in another workbook. All i need is some guidance on how to copy a second worksheet from workbook 1 to a second worksheet in workbook 2. Should be fairl straight forward.

In the below i am copying the sheet Phone_data to a second work book sheet also called Phone_Data, i would like to include in the same proccess a sheet called Sur_Data from workbook 1 copy to a sheet called Sur_Data_R in the second. All the other features like find next empty row also apply.

View 2 Replies View Related

Lookup Name On One Worksheet - Paste Content On Another Worksheet?

Jun 17, 2014

I have worksheet 1 and worksheet 2. I have a different list of names in column A in both worksheets. Some of the names in worksheet 1 are in worksheet 2, but only a partial list. Worksheet 2 names are not in any kind of order and the rows do not match up with worksheet 1. In worksheet 1, column B is filled with each person's email address. In worksheet 2, column B NEEDS to be filled with each person's email address.

Is there a way for me to take each name, sequentially, on worksheet 2 and find that same name in worksheet 1, then pull the email address from column B (beside the name) and copy it to that cell in column B of worksheet 2?

View 2 Replies View Related

Adding Password To Workbook?

Apr 9, 2014

I want to add password to work book. note; it is not for worksheet.

View 4 Replies View Related

Adding To Excel Workbook

Dec 6, 2008

I have a userform that I enter information into fields and I would like to created a command button that will insert the information into the workbook ....

View 14 Replies View Related

Adding A Page To The Workbook With A Name

Dec 30, 2008

I am trying to do a macro and I want to add in a worksheet. I use the code

"Sheets ("Template") .Add"

but I keep getting an debug error. I did this in another macro but cannot find it. I need to add a specific name at the start of adding in a sheet as the sheet number increments change based on how many times you have run the macro. I know this is a silly format issue but I could not find anything in my book or searching this forum.

View 3 Replies View Related







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