Is there a way to have column O pull values from column F is J through L match A through C - excel-formula

I have column A as city code, B as Origin City,St , C as city code, D as Destination city,St. I then similar date in I through L with Carriers that haul those lanes in N. If a row in the I through L match a row in A through D I need the value of F place in the O column in the corresponding row.
I am trying to paste an image of the Excel grid, but I need column O to pull the value from column F from the row that has the values from A to D that match the data in a row in I to L.
Expected Result in Grid

You can use a combination of index() with match()
So, to fill Column O, this should work:
=INDEX(F$40:F$60,MATCH(I40&K40,G$40:G$60,0))
I have assumed that you can add a helper column in G, which is =A40&C40 dragged down.
I have also assumed that the combination of the two numbers in cols A & C are unique when combined.
If that is not the case then you will need to add col B, so the helper column becomes =A4&B40&C40 and the match will be I40&J40&K40.
Tested this on 3 values, as you don't give data I can get to.

Related

Searching a column for a string in one array, and returning a value that corresponds to that array

I am going to do my best to describe this.
I want to search column C for any of the strings contained on a different sheet in column A, and if/when one of those strings is found, i want to return the column B that corresponds to the found string.
For example:
Sheet 1:
Column A
Column B
Column C
project 1
2/15/19
Status is Red, because....
Project 2
4/12/20
RAG- Green, PTG is....
And on another sheet I have common ways to describe their statuses in Column A, and in Column B, a simple letter R, A, G or NS (Not started) if no other common status is found.
Column A
Column B
Column C
Status is Red
R
Rag- Green
G
How can I Search Column C for a value on Column A (on a different sheet) and return column B in Column D on the original sheet?
Results should look like
Column A
Column B
Column C
Column D
project 1
2/15/19
Status is Red, because....
R
Project 2
4/12/20
RAG- Green, PTG is....
G
This may be a bit of an extended function and depends on how many rows you have in the second sheet.
You can hard code it with
=IF(ISNUMBER(SEARCH("Red",C2)),VLOOKUP("Status is Red",Sheet2!$A$2:$B$3,2,FALSE),IF(ISNUMBER(SEARCH("Green",C2)),VLOOKUP("RAG - Green",Sheet2!$A$2:$B$3,2,FALSE),"NS"))
Or use the more dynamic:
=IF(ISNUMBER(SEARCH(Sheet2!$A$2,Sheet1!C2)),VLOOKUP(Sheet2!$A$2,Sheet2!A2:B3,2,FALSE),IF(ISNUMBER(SEARCH(Sheet2!$A$3,Sheet1!C2)),VLOOKUP(Sheet2!$A$3,Sheet2!$A$2:$B$3,2,FALSE),"NS"))
Explanation
SEARCH(find_text,within_text) - returns the index of where the substring begins
ISNUMBER(value) - returns TRUE if a number, FALSE if not.
VLOOKUP(lookup_value,table_array,col_index_num,[range_lookup]) - finds the value within the array and returns the corresponding value in the specified column.
$X$Y - the dollar signs stop the values from changing when you use ctrl+d or ctrl+r to fill multiple cells
So to break it down:
IF (search returns an index)
THEN VLOOKUP (find this value and return the corresponding value from this column)
ELSE (repeat above as needed)
ELSE ("NS")

How to recursively calculate mean of values based on values present in another cell of the same row in Excel

I have a spreadsheet with two columns of values, containing 1000 values each. The first column (column A) contains these values:
W
W
W
T
T
T
The second column (column B) contains these values:
1
2
3
4
5
6
Here is an image of the spreadsheet:
Can you please tell me if there is a way to recursively calculate the mean of those values in column B that have the same value in column A? In my case, the output should be a new column that looks like this:
2
5
As you can see, "2" is the mean of values in column B that has "W" in column A, while "5" is the mean of values in column B that has "T" in column A.
This type of question can be handled using the SubTotals feature, using Average() as the function to be used (instead of the default Sum() function).

Compare user input to two columns and return value from 3rd predefined column

So I am trying to understand how to use excel to complete this exercise.
Basically, I have 4 columns (A, B, C, D). Looks like this:
A B C D E
CRT Carrot CRT CR
Apple Apple APL AP
Basically, I need to scan down column A and compare it to columns B & C. If the word in A matched either the full word in B or the three letter word in C, then I need to take the two-letter word in D and write it in column E.
I've managed to Use VLOOKUP to scan column A and column C and then append to E, however, I can't figure out how to have excel scan both B & C and then append D to E. (main issue here is that the input in A sometimes matches B and sometimes matched C).
Thanks!
I don't have a full grasp of your issue but have you tried aggregating the conditions in other columns like
Have column G Boolean check if A matches a word in B
Have column H Boolean check if A matches a three letter word in C
Have column I = G OR H
then have your result column based on I?
For what you are trying to achieve you can do with a nested if statement:
In Cell E1, use this fromula:
=IF(A1=B1,D1,IF(A1=C1,D1,""))
With the cell still selected, on the bottom right of the cell you will see a small square, click on this small square and drag down to auto-fill all the cells as required.
Formula: =IF(IFERROR(MATCH(A1,B1:C1,0),0)>0,D1,"")
Results:

Lookup a value that matches a key in one column then apply that as a key to return a value from a third column

I have values in columns G and N that have the same values, but not in the same order, so if column G and N matches, then return column L to column A. I am getting the wrong values from column L in column A.
What other information is needed besides formula below?
=IFERROR(VLOOKUP(N2,$G$2:$N$413,6,FALSE),"")
Col a Col b Col G Col L Col M Col N
ID CoID Items ItemsID ParentID Items1
45 1 Apple 45 1 Apple
Since you are trying to find the ColumnL value in the same row as you find the ColumnN value I’d suggest an INDEX MATCH combination – similar to VLOOKUP but more powerful (eg can ‘look to the left’, which VLOOKUP can’t).
=IFERROR(INDEX(L:L,MATCH(G2,N:N,0)),"")
MATCH looks for the position where G2 is found in ColumnN so that is the row number for the ColumnL value you want returned.

Sum of multiple columns if they match

I have this table of data:
A B C D E
003B1016 1 003G1016 1 003B1016
003G1015 1 003G1391 2 003G1015
003H0121 4 003H6208 2 003H0121
003H6209 1 003H6209 1 003H6209
I want to sum B+D if A and C are identical , how would i do that?
I have another 32000 rows of data. :) Thanks for the help
Put this in cell E1 and copy down:
=IF(A1=C1,B1+D1,"")
This says - if A = C, then add B+D. Otherwise, return blank "".
EDIT for new requirements
In order to add all amounts from column B where column A matches the current row and from column D where column C matches that row, where the row in column A exists anywhere and the row in column C exists anywhere, do the following formula in E2 and drag down:
=IF(ISERROR(MATCH(A2,A$1:A1)),IF(ISERROR(MATCH(A2,C:C,0)),"",SUMIFS(B:B,A:A,A2)+SUMIFS(D:D,C:C,A2)),"")
This says: look above the current row in column A - have we seen this item before? If no, continue with the formula. If yes, ignore, to avoid double counting. Then, Look at all of column C - does the value in the current row of A occur anywhere in column C? If no, then don't add anything. If yes, Add all items from column B where column A matches the current row, and add all items from column D where column C matches the current row.

Resources