Combining A Vlook Up With And If Then Statement
May 2, 2006
I have a workbook with 2 tabs
The 1st tab has the following info
A B C
Level Acct Dollars
1 3AAAAA1,631,276.63
2 2BBBBB8,879,065.02
3 1BBBBB86.57
4 3 BBBBB234,986.25
The second tab has the following info:
A B C D
Acct Level 1 Level 2 Level 3
1 BBBBB
2 AAAAA
3 CCCCC
I want to combine a vlook up and an if statement to populate the above tab
to look like:
A B C D
Acct Level 1 Level 2 Level 3
1 BBBBB 86.57 8,879,065.02 234,986.25
2 AAAAA 1,631,276.63
3 CCCCC
View 14 Replies
ADVERTISEMENT
Jan 14, 2009
I have this formula, which works
View 3 Replies
View Related
Nov 4, 2013
I am putting together a spreadsheet that needs to perform different calculations based on the information that is plugged in to the spreadsheet. Right now, I have a simple formula for my final product, which is:
=G2-E3-F3+C3+D3
But, if the variables change, then I have another cell with this formula:
=IF(OR(C4=0,D4=0),"",SUM(G2,H3))
Now, my first problem is that I need to get the information regarding D4 out of the above formula. Someone wrote the formula below to combine the information in cell C3 & D3, so I no longer need the reference to cell D4 in the above formula. How to remove the D4 references without getting an error.
You will notice that the 2nd formula has cell C4. This cell has an IF statement in it. The statement is as follows: =SUM(IF(C3=0.875,D3-0.625,D3))
Basically, what I need to do is to combine the first & second formulas on this page. How to do that.
View 2 Replies
View Related
Jul 23, 2009
I am creating an electronic timesheet. I have created drop downs for times of the day, which then automatically calculates the number of hours worked based on the times selected. The trouble I am having is, I also need to incorporate "Vacation", "Sick Day", etc into the drop down box where the time of day is located.
The sheet works great until someone selects a non-time related answer, such as "Vacation". When this option is selected, the cell that is supposed to contain the number of hours worked says #VALUE! when I, in fact, need it to list a value of 0 for the number of hours worked. Any idea on how to combine my formula =(D6-D5)*24+(D8-D7)*24+(D10-D9)*24 with an IF statement that will automatically assign a value of 0 if a text answer is selected from the drop down?
View 6 Replies
View Related
Nov 30, 2009
I am using a Vlookup to pull through information from a worksheet, but I am wanting to vlookup in column a on 12 different worksheets to then pull back corresponding information.
Example
12 worksheets - January through to December.
On each worksheet the first colum is a unique reference number 00001, 00002, etc depending on when we have ordered the goods and each column after that has amount order etc.
In a completely seperate workbook I want to input the unique reference and it to bring back certain information. I have used Vlook up for this, but this only appears to work when searching one worksheet. Is there anyway I can get it to search the whole workbook and bring back the information?
View 11 Replies
View Related
Mar 9, 2009
I'm creating a look up function for the staff where you enter in the zip code, and it returns a series of answers (the state the zip code is attached to, the shipping code to use for regular shipping, next day air, and IF it is available for that zip code, the codes to use for Saturday shipping).
My problem is the fact that I'm looking up zipcodes. I have the cells, both the one where you enter in the zipcode to look up AND the entire column of the 29,000+ zipcodes formatted as "zipcode". However the cell where you enter in the zipcode.. it shows the "0" in the cell, but Excel thinks it's four numbers.. it's not recognizing the "0" in the function line. This means Vlookup is trying to find a 4 digit number, and not the 5 digit one I am asking it to, thus I get #N/A as a result for any zip code starting with "0". Every zipcode that starts with 1 or higher looks up just fine.
I have it set as FALSE so it will return the #N/A when you enter in a nonshippable zipcode, or one that doesn't exist.
If I change to TEXT, then it will not look up anything past "0" in the list, so all answers higher that 070xx (new jersey) come back as #N/A
I'd really like to have just 1 look up, not two, one for Zipcodes starting in "0" and one for zipcodes starting with "1-9". Does anyone know what I can do here? I've tried combinations, but am I just missing something? I'd rather not go back and just drop the 0 in the lookup column of the zipcodes to make this work.. I spent hours reformatting this whole column to show right int he first place.
View 6 Replies
View Related
Oct 24, 2003
I have a database containing dates and activities (text) on the speciified dates.
In some cases a date might have more then one activity therefore I need XL to (on a separate sheet?) merge the text.
E.g:
Sheet1
A B
2004-01-03Lunch with Marie
2004-01-03Reply from MrExcel?
2004-01-04Draft
Wanted 'end-result':
Sheet2
A B
2004-01-03Lunch with Marie; Reply from MrExcel?
2004-01-04Draft
View 9 Replies
View Related
Nov 13, 2008
I have a query and not sure if it can be done.
I did have alook across the search forum and web generally and didnt come up with too much luck only found the following [url]
What i am trying to achieve is the following
I have a list of names which i need to do a Vlookup against
the first part works fine
=VLOOKUP(C2,'[ALL_CFA Sales-IM User Profiles edited 2008_11_09.xls]Sales'!$G$2:$H$516,2,0)
Where i come stuck is that some names will be on another worksheet on the same workbook.
I.e i have done a vlookup against sales profile on the first worksheet, but some names shall be on the next worksheet as their "Job Profiles" will be different
Is there a way to extend the vlookup across multiple worksheets in the same workbook,
No two names will be duplicated across the worksheets (unless by pure chance i.e if there happens to be two Steve Smiths this will be two different people and not one indivdual)
View 9 Replies
View Related
Mar 8, 2009
On sheet one, I am trying to match the employees job code for that particular week in cell K2. The vlookup/match is trying to find the particular job code for that employee number for that particular week ending.
Cell A2 (sheet 1, shows their employee #),
Cell J2 (sheet 1) has that particular week ending.
Cell K2 has this formula in sheet 1:
=VLOOKUP(A2,Sheet2!A:C,3,MATCH(J2,Sheet2!$D$1:$D$5,0))
Sheet 2
Column A = employee numbers
Column C = job codes (which I need to appear in cell K2 for sheet 1)
Column D = has the week endings to match against column J in sheet 1
View 2 Replies
View Related
Oct 26, 2012
is it possible to use the VLook up function to look at a range of numbers - I.e.
30-40, answer = 15%, I have tried 30-40 also 30,40 but none seem to work?cualte?
View 4 Replies
View Related
Mar 20, 2009
I want to Vlook a value from a cell in another workbook then before I get the formula result I would like it to concatenate the result with another cell.
I have attached an example
AlEXAMPLE.xls
View 2 Replies
View Related
Dec 19, 2008
Sheet 1
23456
23479
23409
23512
Sheet 2
23455
23456
23457
23478
23479
23480
23408
23409
23410
23511
23512
23513
In Sheet 1 there's a Column B with data I'd like to pull using a VLOOK-UP formula. However, I need it too look-up not only the exact number match in Sheet 2, but also the cell directly above it and the cell directly below it. In the sample above if I placed the VLOOK-UP formula in Sheet 2 (at for instance the numbers 23455, 23456, 23457), I'd need it to pull data from Sheet 1, Column B (for the 23456).
View 9 Replies
View Related
Aug 28, 2009
I am having problem with vlookup.
Cell 1 contains 134 cell 2 contains account number.
can look up value be in 2 columns? It has to be the exact match for both cell in order to generate the data. Thanks.
View 9 Replies
View Related
Dec 30, 2009
I am trying to do Vlook up but the reference cell indicates formula error even if this has values.
I have to do F2 in every cell to make the Vlookup work. Is there any way to remove this?
View 9 Replies
View Related
Dec 3, 2009
Table 1:
I like to go to Berlin.
You like to move to Amsterdam.
They want to see Chicago.
When will the reach San Francisco.
Table 2:
Amsterdam
Chicago
San Francisco
Berlin
What I want to do:
I want my function to see if the text in Table 1 contains a value in Table 2, and if yes, output that value.
Desired Result:
Row A1:
I like to go to Berlin.
Row A2:
Berlin
Row B1:
You like to move to Amsterdam.
Row B2:
Amsterdam
View 9 Replies
View Related
Jul 28, 2009
I am currently using an Intersect statement in a worksheet module to perform two things:
1. Insert a time stamp into row 2 when row 1 has a price inserted
2.To clear that time stamp if the price is deleted at some later date.
My problem is with the time stamp value being deleted by the user.
If I try to clear the price (now that the time cell =empty) I get a Runtime error 91 - Object Variable or With block variable not set.
I would like to convert this code to a select case statement but I'm not sure how to do this in this situation. Would error coding be appropriate in this instance?
View 5 Replies
View Related
Jun 9, 2006
I have a userform where I have 2 comboboxes. The first combobox shows the the first column (only 1 of each) and the second comboBox shows me the secondary list that correlates to the valuse in the first from column B. Now I have a text box that I am trying to get the value from column C depending on what I have in the first 2 comboboxes. What is the easiest way to do it? This is all in VB since it is a UserForm, and using Vlookup seems to be too many lines if I go that route. Is there a way to use Index and Match in VB where it would be more efficient? I attached just a sample of how the data would be layed out in the Excel sheet.
View 4 Replies
View Related
Oct 1, 2008
I'm trying to set up an if statement that will recognize that if a cell is FHR it will do something...but if it's PHR it will do something else. I think I found the place where I keep getting an error but I'm not sure how to go about fixing the issue.
View 2 Replies
View Related
Feb 14, 2012
I am attempting to use a previously Set variable as part of the next Set statement, pretty unsuccessfully at present.
My purpose is trying to look up
Code:
tb_SelJobID.Value
from a userform in Col Z then look across the row to Cols D,I,N,S & W (different types of work) to see if
Code:
TbSelYr.Value
matches the year selected then insert a formula in the row to the left. Then loop down to the FinalRow.
Currently my Set Found1 statement does not recognise my Found10 value. I know it will be my syntax as it always is. I have cut down the following code to display where the problem areas are, Found1 thru 5.
Code:
Sub CmdGo3_Click()
Dim Row As Range
Dim FinalRow As Long
Dim Found1, Found2, Found3, Found4, Found5, Found10 As Range
Application.ScreenUpdating = False
[code]....
Windows 7 with Excel 2010
View 9 Replies
View Related
May 5, 2014
I have an Excel Sheet which I use as Database. The database has 11 columns and I insert data with the following function:
Code:
Sub testInsert()
Dim adoCommand As New ADODB.Command
Dim sQuery As String
Dim i As Integer
Dim strTest As String
strTest = "test"
[Code] .......
Now I want to retrieve this data. i.e. I want all F1 where F2 and F3 are 0 AND I want them ordered descending. I'm trying to achieve this with:
Code:
Sub testSelect()
Dim adoCommand As New ADODB.Command
Dim sQuery As String
Dim mrs As New ADODB.Recordset
Dim strTest As String
strTest = "test"
[Code] ....
The result I am getting looks like this:
9
8
7
6
5
4
3
2
15
14
13
12
11
10
1
I assume, that the data is interpreted as String instead of an integer. But I explicitely stated the data as Integer when storing the data into the DB.
View 5 Replies
View Related
Jan 6, 2009
I have created a very long switch statement, which is too long to be placed in one row in VBA. I have attempted to put a space and underscore at the end of one line and continue the statement on the row below by placing a comma at the start of the second line. VBA will accept my efforts, but when I run the statement in the immediate window, the following error appears.
"Invalid procedure call or argument"
I understand that there are certain rules where I can split a switch statement onto two lines, yet I do not know what they may be.
View 9 Replies
View Related
Mar 18, 2014
I am looking to have one formula containing two If Statements that minus.
=IF(B6="investment",C6,0)-IF(B7="gross",C6,0)
So the result of If Statement 1 minus the result of If Statement 2.
What I am seeing at the moment in the cell is FALSE and what I want to see is the sum.
View 2 Replies
View Related
Jun 13, 2009
If A1 shows 10:00am and A2 shows 4:00pm, then A3 calculates the total number of hours: =(A2-A1)*24
But if A1 shows "Off," then A3 shows 0: =IF(A1="Off",0,(A2-A1)*24)
Now, if I want to change "(A2-A1)*24" to another if-statement, how do I do this? I can always set up a hidden cell (A4) that contains the results of the first if-statement, and then say: =IF(A1="Off",0,A4). But can I do this without going through all the trouble of setting up hidden cells?
View 3 Replies
View Related
Apr 25, 2007
Each row represents a call. If a call in column A equals "CW" and it has the highest duration (H:MM:SS) value in column B, then provide me the date (MM/DD/YYYY) for that call that is stated in column C.
i.e.
Column A --- Column B ---- Column C
AB ------------ 0:02:22 ----- 04/14/2007
CW ----------- 0:03:13 ----- 04/16/2007
CW ----------- 0:01:42 ----- 04/13/2007
Thus, the value that should be returned is "04/16/2007".
View 9 Replies
View Related
Jul 3, 2007
I have a problem with a formula inserted with control+shift+enter
The formula is
MEAN(IF(' VALIDATION'!$G$2:$G$59999=D30;'VALIDATION'!$E$2:$E$59999))
In the Validation sheet I have the column G with values 0 and 1, and another column E with numeric values.
Changing the value of cell D30, the formula will calculate the mean of the values in column E that have a value equal to D30 in column G.
The problem is that this function works when D30=1 and not when d30=0, in this case the formula returns N/D.
I have tried using also text values instead of 1 and the formula works . The problem is only when D30 is 0
View 7 Replies
View Related
Apr 22, 2009
I am trying to have a cell in sheet "Summary" count the number of cells in column DX of sheet "Analyses" that are greater than 0, provided that the value in column A of "Analyses" corresponds with the value in B8 of sheet "Summary."
(In "Analyses," there are 106 subjects, each taking up 64 rows. So, columns 1-64 correspond to Subject 1, columns 65-128 correspond to subject 2, etc. In column DX, each subject has 64 values that are either 0 or greater than 0. In "Summary," each subject has one row that summarizes the 64 trials. I want a single cell in the "Summary," sheet to reflect the number of times each subject produces a value greater than 0 in column DX of "Analyses.") I tried using this formula, but it did not work correctly:
=COUNTIF(IF(Analyses!$A$1:$A$10000=Summary!B8,Analyses!$DX$1:$DX$10000,""),">0")
(Summary!B8 = 1, so I am trying to calculate the number of values in DX that are greater than 0 only for subject 1.) When I press enter, this yields a value of 384. This is impossible, given that subject 1 only has 64 possibilities of yielding a value greater than 0. Subject 1 has 2 values in column DX that are greater than 0. I tried making this an array formula by pressing Shift+Ctrl+Enter, and that just gives me a #VALUE! error.
View 5 Replies
View Related
Jan 7, 2009
I have some code where I use and statements, as follows:
View 4 Replies
View Related
Jan 14, 2007
I want to see if a goal has been met and get a "Yes" or "No" so I wrote
=If(A1>=A2),"Yes","No"
But on months not worked where goal and production both equal 0 then I am getting a return of Yes. How can I say is A1 >= to A2, but if both are 0 return N/A?
View 12 Replies
View Related
Apr 20, 2009
I am having problems combining AND and OR into a single statement. To start I have a statement =IF(AND(B978="P",R978=0,S978=0),"processed",""). If B=P and R=blank and S=blank then display PROCEED else make blank.
What I want to do is check if S is blank or "N" but when I try to add an OR I get error messages regarding missings )'s =IF(AND(B978="P",R978=0,OR(S978=0,S978="N"),"processed","").
View 3 Replies
View Related
Oct 11, 2012
I have two vba the first one records the date & time of a cell change in column a and places this in column b
Private Sub Worksheet_Change(ByVal Target As Range)
If Not Intersect(Target, Range("a:a")) Is Nothing Then
Target.Offset(0, 1) = Date & " " & Time
End If
End Sub
The second one is a function to get the User logged in to windows.
Function UNameWindows() As String
UNameWindows = Environ("USERNAME")
End Function
What I really could do with is a way of incorporating the user name in the first function so it records date, time and user?
View 3 Replies
View Related