Referring to another sheet's cell depending on the value of another - excel

Not quite sure how to word it, but I'm currently doing a project on excel. So far I have the invoice sheet containing the customer number and pricing etc etc, and another to contain all customer information such as their home and email address and phone numbers in order of their customer number.
I am currently trying to have a formula automatically add the name of the customer depending on the number entered in the invoice. By this, I mean that when I enter a number in the column, it will refer to the customer spread sheet and retrieve the name. But I'm not sure how I will do this.
The only thing that comes to my head, is that logically it would be something like '=Customers!B(D3)', where D3 is the customer number. I would have thought that it would get the value of D3, and say D3 contains the number 3 then it will go to cell B3 in sheet Customers.
I'm not sure how to do this, so is there some sort of GetValue function? I mainly code Java so am fairly new to Excel.
Any help would be greatly appreciated,
Thanks :)

There is a few different functions you could use for this but the best would be INDEX
To get the value in Column B use =Index(Customers!B1:H100,D3,1)
Column C =Index(Customers!B1:H100,D3,2)
The first argument is the range, second argument is row position, and third position is column position.
Here is some documentation to read

Related

Excel : Copy muitple columns to rows based on one column

I'm looking for the most efficient approach to transferring information from three columns to one row, right next to each other depending on the company name.
Consider the following example:
I have a 226k data list with product details for several customers (around 30-40k).
One customer can have 2 to 50 products, each with a serial number and a product number. Check out the source data pic.
Output required: One row per customer will have all the product data, serial number, and product number next to each other.
Source data
desired output
I have never used Macro. Can someone please help me find the best way to deal with this issue?
This one is pretty tricky, you'll need to play with column numbers to adjust formula:
The customer list in column F must be typed manually or if you have Excel 365 you may benefit from UNIQUE Function. I did it manually.
My formula in cell G2 is an array formula (must be entered pressing SHIFT+CTRL+ENTER or it won't work!
=IFERROR(INDEX(SI($D$2:$D$14=$F2;CHOOSE(COLUMN()-6-INTEGER((COLUMN()-7)/3)*3;$A$2:$A$14;$B$2:$B$14;$C$2:$C$14);"");MATCH($F2;$D$2:$D$14;0)+INTEGER((COLUMN()-7)/3));"")
Drag to right and then drag to down.
My formula uses the value 6 and 7 because my data starts at column G, that means column number 7. So if you put this somewhere else, make sure you change also 7 and 6 values to the proper values!
Anyways, I've uploaded a sample to Gdrive in case you want to check the formulas by yourself.
https://docs.google.com/spreadsheets/d/1TvNUVt0ArzyFK_jsRtZfX1ja2zUgSdhR/edit?usp=sharing&ouid=114417674018837700466&rtpof=true&sd=true

Vlookup DragDown

Im beginning a new job in a fabric. Actually, for each product, they have a excel file with the product operations in different sheets. I saw that a real problem, it takes a lot of time, and every time we should have to change the layout of the order, we are going to need to change a lot of excel files.. It will take forever and I think I can help on that.
So, my idea, is making a sheet with all the products and their operations and formulas:
Then, I have maked another sheet with the order fabrication with all the operations needed to make the product:
Every product will have an ID and im using in all cells the vlookup function from the ID:
=IFERROR(VLOOKUP($K$3;'estrutura-artigos2'!B8:V71;5;FALSE);"")
And Its Ok like you see on the last image, the problem is when I change the ID it doenst change like it should be (on my head):
Can anyone help me on this problem? I want it to change always to the ID I insert, and dont continue with the new ID.
=IFERROR(INDEX(Sheet1!E:E;MATCH(1;($K$3=Sheet1!$A:$A)*(COUNTIF($A$6:$A6;Sheet1!$E:$E)=0);0));"")
As your examples show no columns or rows I made my own. Please modify the formula to your ranges. Sheet1 is your datasheet.
Column A in Sheet1 is the column holding the ID in your datasheet.
Column E in Sheet1 is the column holding the 'op' in your datasheet (between qty and machine column).
Counting starts at row 6 in my example, but modify it to the cell above where you put your formula.
Enter the formula with ctrl+shift+enter as it is an array formula.
Change the index for the different results, but keep the rest of the formula unchanged.
Updated answer based on the visibility in rows and columns:
In A13 use =IFERROR(INDEX(datasheet!F$8:F$72;MATCH(1;($K$3=datasheet!$B$8:$B$72)*(COUNTIF($A$12:$A12;datasheet!$F$8:$F$72)=0);0));"")
Match returns the row number of the first match where datasheet column B equals the value in $K$3 and where the values of datasheet column F don't equal any of the previous results of this formula in column A (above the current row number)
The result is the row number that needs shown from the indexed column.
For the issue im having, this is as far I already went thanks to #P.b:
The problem im having is that the formula Im using goes right no operation 20, instead going to the operation 1, any idea how to fix this?
Formula using on the A13 = =IFERROR(INDEX(datasheet!F:F;MATCH(1;($K$3=datasheet!$B:$B)*(COUNTIF(datasheet!$B$8:$B71;datasheet!$F:$F)=0);0));"")

New column in Excel to determine if given account number has one or both product types

I have a three-column data set in Excel: Column A is Account Number, Column B is Product Type, and Column C is Current Balance (see image below).
The table I'm using has +150,000 rows, the image above is for illustrative purpose to simplify what I'm looking at. Multiple rows may have the same Account Number, but a different Product Type and/or Current Balance.
I would like to create a new column for a unique identifier that would label an Account Number as having "All A's", "All B's", or "Both". What in Excel (formula, VBA, etc) can be used to achieve this?
You can create a helper column in Column A and use the following formula starting in A2
=IF(COUNTIF($B$2:$B$9,$B2)=COUNTIFS($B$2:$B$9,$B2,$C$2:$C$9,$C2),"All "&$C2&"'s","Both")
EDIT:
You can also take it one step further and only return the requested answer for the first occurrence of an Account Number by using the following formula (again by beginning in A2)
=IF(COUNTIF($B$2:$B2,$B2)>1,"",IF(COUNTIF($B$2:$B$9,$B2)=COUNTIFS($B$2:$B$9,$B2,$C$2:$C$9,$C2),"All "&$C2&"'s","Both"))
I believe this formula would work (tweak for your ranges):
=IF(AND(COUNTIFS($B$2:$B$9,"A",$A$2:$A$9,D2)>0,COUNTIFS($B$2:$B$9,"B",$A$2:$A$9,D2)),"Both",IF(COUNTIFS($B$2:$B$9,"A",$A$2:$A$9,D2)>0,"All A's","All B's"))
#Kris - Please try the below solution.
I have added a new column by concatenating Account Number and Product Type. Using this column, created an Identifier column with the formula below.
Identifier column formula:
IF(COUNTIF($A$2:$A$9,A2)=COUNTIF($D$2:$D$9,D2),"All"&B2,"Both")
Hope this helps.

HYPERLINK with variable (column name or cell) containing the carrier's Tracking Number

My spreadsheet now contains FedEx, UPS and a regional carrier. For approximately, five shipments and three or so purchases per day, I hyperlink these tracking numbers myself each day.
Is there a way to us either my column called "TRACKING" OR the cell in the column for each row to create the unique hyperlink for each row?
I can create two extra columns to do this because I don't know how to use the IF function to make a decision between if it is UPS (1Z...) versus FedEx (always numbers).
The manual hyperlinks I am using are:
http://wwwapps.ups.com/ietracking/tracking.cgi?tracknum=
https://www.fedex.com/insight/findit/nrp.jsp?tracknumbers=
And of course I have a column with the tracking number shown (happens to be column I). All info regarding each transaction is fully contained in the row. Only one transaction per row.
I think I see what you're asking.
Say your column I has the UPS/FedEx numbers. Put this formula in B1 and drag down:
=IF(LEFT($I1,2)="1Z",HYPERLINK("http://wwwapps.ups.com/ietracking/tracking.cgi?tracknum="&$I1,"UPS Link"),HYPERLINK("https://www.fedex.com/insight/findit/nrp.jsp?tracknumbers="&$I1,"FedEx Link"))
The way the If statement works is this: It looks in your cell I1 (again, assuming your tracking numbers are there), and looks at the left most two characters. If they're "1Z", then it uses the hyperlink() function to create the link to UPS, otherwise it uses the FedEx URL.

Entering repeating data in Excel

I am a travel agent and maintain a data base tracking my commission. I am constantly adding new bookings which consist of a hotel name, address and zip code. Many of these hotels I use quite frequently so when i type the name of the hotel in cell A1, I wold like cell A2 to automatically populate with the address, cell A3 to populate with the state and cell A4 to populate with the zip. I could eliminate a lot of data entry. How could I do this.
In another sheet enter the information for all the hotels. I suppose that you could have unique names for your hotels. You can use VLOOKUP() to search that table and populate that information.
If you want the information to appear automatically, just have more rows of formula than you have data on your sheet and use IFERROR() so that if there is no data entered into the first column you do not display an error.
As you can see here, the information is retrieved via VLOOKUP on another sheet and the formula you see is in B2. Normally that cell should display #N/A but since we are using IFERROR() this does not happen and you have a nice output.
And here because I think you might not be familiar with VLOOKUP. VLOOKUP has 4 parameters:
The value to look for;
The range in which 1) the value to look for is and 2) the value to retrieve is;
The number of the column in which the information to retrieve is;
0 if you want an exact match, 1 if you want an approximate match
You just have to remember that VLOOKUP will always use the first column of the supplied range to search for the specified value so you 'key' has to be in the first column.
Create an additional worksheet containing the hotel data and then use something like vlookup from your primary worksheet.

Resources