Display information in cell based on other cell value - excel

I have a client list database on a excel document. What I need is to display client information by entering a number (each client has a code). For example, if I enter the number "1" it would have to show the info of number one client. I thought that I could do someshing like these:
The codes of the clients start at A1 cell, and the names at B1. On another part of the document (let's say on the cell G4), I enter a number, for example number 7. Then, I want the cell above to the "7" (G5) display the name of the client. To do it I thought to link the cell to the B column (where the names are) and the row that says the cell G4 (in that case G4=7). That would point to the right cell by entering a fixed column and a variable row. The problem is that I have no idea on how I could do these. I tried entering a formula like "=LINK(B(G4))" but this is not a correct formula. How these could be done? So many thanks in advance.

Try to use following formula in G5:
=VLOOKUP(G4,$A:$B,2,0)
If an exact match is not found, the error value #N/A is returned.
You can also modify formula to return "not found" (or another message) instead #N/A:
for excel 2007 or later:
=IFERROR(VLOOKUP(G4,$A:$B,2,0),"not found")
for excel 2003:
=IF(ISERROR(VLOOKUP(G4,$A:$B,2,0)), "not found", VLOOKUP(G4,$A:$B,2,0))
You can read more about VLOOKUP here.

Related

Excel execute function when cell is clicked

Is there a way to execute a formula when a cell is clicked or get adress of selected cell and then if it matches execute formula without using VBA?
There is something that almost does want you want natively in Excel without VBA.
The CELL function allows you to access some (fairly limited) information about a particular cell. If you choose, you can direct the function to give you information about a particular cell, or you can let the function give you information about the last cell which had information entered in it.
For example, the following tells you the width of cell A1:
=CELL("width",A1)
Whereas the following (without a second argument provided) tells you the address of the last cell where data was entered:
=CELL("address")
For your purposes, you can use this information in other formulas to act based on where you have most recently entered data, like so:
=IF(CELL("address") = "$A$1", "A1 was the last cell entered!", "")

IF Function leaving Date-Formatted Cell Blank

I have a cell Formatted as a date (M/dd/yyyy HH:mm). The function in this cell is:
=IF($CX$30,MAIN_LEL_BUMP,"")
This is saying that if a check box is clicked (CX30), find the value of MAIN_LEL_BUMP, otherwise leave the cell blank. The issue is sometimes the users do not enter the value of MAIN_LEL_BUMP and consequently the cell gets autofilled with 1/0/1900 0:00. This will pass my date validation checker that I have, but needs to be the accurate date. if MAIN_LEL_BUMP is not filled out, then it absolutely needs to leave the cell blank so that the data validation will pick it up as not being entered. I have looked around on the web for this, and changing the "" to the actual cell name did not work either. HELP
Seems like all you need is one extra condition to check the value of that cell. The following formula will only use the value of MAIN_LEL_BUMP if your original criteria AND MAIN_LEL_BUMP is not empty. If either condition fails you will get your empty cell.
=If(AND($CX$30,MAIN_LEL_BUMP<>""),MAIN_LEL_BUMP,"")

Simple VlookUp on MS Excel not working

I am trying to use VLookUp from MS Excel 2010 for the data below:
Basically I want to update the Value of CostA by the Value given in Cost by using the Job Ref but ends up #NA
The formula I paste in cell B4: =VLOOKUP(A4,E3:F4,5,FALSE)
NOTE: The Column A Job Ref is a link but even when I remove the hyperlink the same problem occurs. I have attached the Excel file.
Excel file
The Job Ref number is stored as text. Select cell A4 and (a) click the drop down and select "Convert to Number" or (b) go to edit mode by hitting F2 then press Enter.
Also, your VLOOKUP reference is outside your table. Change 5 to 2.
=vlookup(A4,$E$3:$F$4,2,false)
The $ signs fix the range that your formula is looking in. When your doing more lookups (e.g. have more job references in cells A5, A6 etc), you can just paste the formula down (don't forgot to extend your range).
The 2 means when finding that job ref, return the result from the second column of your data set, with your data set being E3:F4. Because in your initial formula that was a 5, the vlookup was finding the job ref, then it's trying to return the 5th column, but E3:F4 is obviously only 2 columns so it'll return an error.
Hopefully this helps.

Excel get previous value of the cell after sorting of data

How do I get the previous cell value in an Excel sheet?
For example, if I have data in the below order :
A1000 - StackOverflow
A1001 - Some other flow
A2000 - StackOverflow
And then I sort to get something like this:
A1000 - StackOverflow
A2000 - StackOverflow
So the cells with the value "StackOverflow" will be one below the other.
I want to find the value of the cell that is above A2000 after sorting ? I tried INDIRECT("A"&Row()-1), but it returns A1999 where I want A1000.
If you can't simply put the value into a VBA variable before sorting, then you could put a defined name on the cell value you want to keep referencing to. The defined name will remain in the same cell even if you move it to a different address. You do this in the top left corner, right next to the formula bar.
So in this case you could enter a name like "myCell" for the cell you want, then refer to it by writing "=myCell" as a formula in another cell.

How to look up information based off a single cell? In Excel

I've been working on VBA for so long I forgot how to do this...using formulas.
I have a cell that has a descriptor in it, in this case K1122121. The cell next to it, will be the description. On another sheet I have a list of parts, I need to look up said part number on sheet 2, and place the description next to the part it's looking up.
I know it's possible, I just forget how.
So to recap.
Sheet one has two cells, the first is a part number, the 2nd next to it, is where the formula is going, in this cell will produce the description to said part number.
Sheet two has part and description side by side. I need to reference the part number and find the description.
Once the description is found, place said description in the description field in sheet one.
Thanks for the help.
Here is a link of what I am working on. https://dl.dropbox.com/u/3327208/Excel/PAERTO.xlsm
It's called VLOOKUP and you call it like this:
=VLOOKUP(A1,Sheet2!A:B,2,FALSE)
Where:
A1 is the cell with the part number in sheet1
Sheet2 the sheet where the data is located (descriptor / description)
A:B is the range in sheet2 where the data is located
2 because what you are looking for is in the second column
FALSE to only get a value for exact matches - if no exact match is found, it will show an error
EDIT
Looking at your workbook, I would personally insert a new column in the jobs list (say between D and E) with a formula that only keeps the first word only - formula in E3:
=IF(ISERROR(FIND(" ",D3)),D3,LEFT(D3,FIND(" ",D3)-1))
Then the formula in the PAERTO sheet then becomes - formula in D20:
=VLOOKUP($E20,'Jobs List'!$E:$F,2,FALSE)
in the example you provided, I get a result for lines 20, 22 and 24, and an error on the other lines.
I can get a result if I use this formula:
=VLOOKUP(E20&" Rev"&F20,'Jobs List'!D:E,2,0)
However you need to change cell F20 to 4.
As long as part number and "Rev" are consistent between sheets, this formula should work.
Note that only cells D20 and D24 return values. The other part numbers don't exist on the other sheet, so regardless of what formula is used you will not see a return value.
With your part number in A1, in B1 the formula =VLOOKUP(A1,Sheet2!A:B,2,FALSE) will find the description
If you are on Excel 2003 or earlier, you will have to change Sheet2!A:B to be a full reference like Sheet2!A2:B2000
The answer was a little more complex than I was hoping, but I ended up using this as an answer. It may not be the most simplistic, or elegant, but it works.
=IF(E20=0,VLOOKUP("*"&E20&"*",'Jobs List'!D:E,2,FALSE),VLOOKUP("*"&E20&"*",'JL Archive'!D:E,2,FALSE))
I used the "*" to make it so that it utilized wild cards, something I never thought of using... but it works. I put the wildcard usage in front and behind so just in case any cells may have something more than the required text in the front of the part or behind it.
I hope this helps people. The original use for this was so I can use the formula can be used from another workbook, but as we all know this can be used anywhere. Enjoy :)

Resources