Find text in column one and copy value from next column to column 3 in Excel [duplicate] - excel

This question already has answers here:
Check if Cell value exists in Column, and then get the value of the NEXT Cell
(3 answers)
Closed 8 years ago.
Column 1 in my spread sheet contains text (just 1 word), 2nd column numbers and column 3 will have those numbers in specific order.
Example:
cell values
A3 aaaa
A4 bbbb
A5 cccc
A6 dddd
A7 eeee
A8 ffff
B3 11
B4 22
B5 33
B6 44
B7 55
B8 66
I want cell C3 to search the whole column A for a word ffff and once it found it, it would copy a value of the cell next to it in column B. So if the word ffff was in cell A8 the cell C3 would be 66 as B8=66. If ffff was in A5 than C3 would be 33 etc. After that I want C4 to find a word cccc in column A and copy value from next cell in column B and so on. Does anyone know how can I do it? Can this be done without using macros?

You can use VLOOKUP function, e.g. in C3
=VLOOKUP("ffff",A:B,2,FALSE)
the 2 tells Excel to return the value from column 2 of the specified range (A:B) and FALSE means that only exact matches are considered - see Excel help for more on VLOOKUP

Related

Lookup last non blank cell associated with a value

I have a table with two columns, ID and Value. Each Value is associated with an ID. However, some Values are blank.
My table
ID Value
A2 102
A3 108
A4
A2 148
A3 91
A5 13
A3 Dog
A4 119
A5 58
A3
A4 Cat
A6
I want to look up the last non blank Value for each ID. I need this to work for all data types (numbers, strings, dates, etc). Also, some IDs may have no values at all. The formula should return "" for these.
Desired results below
ID Last Value
A2 148
A3 Dog
A4 Cat
A5 58
A6
What I've tried
=LOOKUP(9.99999999999999E+307,IF(A2:A12=D2,IF(ISNUMBER(B2:B12),B2:B12))) This works but only for numbers.
=LOOKUP(2,1/($A$2:$A$12=D2),$B$2:$B$12) Returns 0, which is the blank for A3.
=LOOKUP(2,1/(NOT(ISBLANK(B2:B12))),B2:B12) Returns 92, which is simply the last value.
=LOOKUP(2,1/($A$2:$A$12=D2),(NOT(ISBLANK($B$2:$B$12)))) Returns FALSE is there is a blank and TRUE is there are no blanks.
=LOOKUP(2,1/($A$2:$A$12=D2),NOT(ISBLANK($B$2:$B$12)),$B$2:$B$12) but the syntax is incorrect (too many arguments).
You can do something like this (as an array formula)

Complex excel problem, parse string then get max date from cell next to matching cell

Below I have one or more strings in cells D7 D8 and D9 separated by a comma. I would like to get the max date corresponding to the numbers provided.
--- Col A Col B
Row 1 number date
Row 2 1.0 1/1/2018
Row 3 1.1 1/2/2018
Row 4 1.3 1/5/2018
Row 5 1.6 1/3/2018
Row 6 1.8 1/4/2018
text string in cell D7 = 1.1,1.6
output = 1/3/2018
text string in cell D8 = 1.1
output = 1/2/2018
text string in cell D9 = 1.8,1.6,1.3
output = 1/5/2018
Use this array formula:
=MAX(INDEX(B:B,N(IF({1},MATCH(--TRIM(MID(SUBSTITUTE(D2,",",REPT(" ",99)),(ROW($A$1:INDEX($A:$A,LEN(D2)-LEN(SUBSTITUTE(D2,",",""))+1))-1)*99+1,99)),A:A,0)))))
Being an array formula one must first put the formula in the First cell then hit Ctrl-Shift-Enter instead of Enter when exiting edit mode, then copy down the dataset.
Another using SUMIFS:
=MAX(SUMIFS(B:B,A:A,TRIM(MID(SUBSTITUTE(D2,",",REPT(" ",99)),(ROW($A$1:INDEX($A:$A,LEN(D2)-LEN(SUBSTITUTE(D2,",",""))+1))-1)*99+1,99))))
Still an array formula

Sum fields in a column if there is an entry in a corresponding row in another column

Assume the following data:
| A B C
--+------------------------
1 | 2 3 5
2 | 2 3
3 | 4 4
4 | 2 3
5 | 5 6
In cell A6, I want Excel to add cells C1, C2, C3 on the basis that A1, A2 and A3 have data in. Similarly, I want B6 to add together C1, C4 and C5 because B1, B4 and B5 have data.
Can someone help?
In A6 enter:
=SUMPRODUCT(($C1:$C5)*(A1:A5<>""))
and then copy to B6:
A simple SUMIF formula will work
=SUMIF(A$1:A$5,"<>",$C$1:$C$5)
Place that formula is cell A6 and then copy it to B6.
You can create another column, e.g. AValue, with the formula =IF(ISBLANK(A1),0,A1) in it. This will return 0 if the cell in A in the corresponding line is empty, or the value from the cell in A otherwise.
Then you can just sum up the values of the new column.

How do I link the content of a cell to another worksheet as opposed to the value?

I realize my title doesn't really explain what I'm asking as I don't know the correct terminology but bear with me and I'll explain my question.
I know how to link two cells so that if one changes, the other does as well (i.e. cell C3 is linked to cell E5 by selecting cell C3 and entering "=E5"). But how do I link the information in the cell to another cell?
If my worksheet looks like this:
cell B1 - Grapes, cell C1 - 50
cell B2 - Apples, cell C2 - 60
and I link cell F1 to cell C2 with "=C2". If I change the order of cell B1 and cell B2 to become alphabetical then cell F1 is no longer linked to the value in cell C2 (50) but changes to the value that now becomes cell C2 (60). How do I link cell F1 to the actual value (50) in cell C2 even if the order changes.
Help... Thank you!
Not sure if this is an efficient method; if i correctly understood your question then you can use = to link two cells For example:
Sheet one can look like this
A B C D E
1 1 2 3 4 5
2 5 4 3 2 1
3 1 2 3 4 5
Total 7 8 9 10 11
Sheet two requires cell links so you do:
TotalForA =Sheet1!A4 //output will be 7
TotalForB =Sheet1!B4 //output will be 8
.
.
.
In a simple word you can use = sign and click on whatever cell you're like to get.

extract data from column based on subset of data from other other column

This is how my data looks like:
C1 C2 C3
1 1 a
2 2 a
3 3 a
4 4 a
7 5 a
8 6 a
9 7 a
10 8 a
9 a
10 b
You see that C1 is a subset of column C2. I want now to extract only the data from C2 - together with the corresponding value from C3 - that matches C1. The extracted data just needs to be copied to another column
Could someone give me a hand?
Assuming your data in C1 starts from A2, do the following:
Type in cell D2 (column C4): =IFERROR(VLOOKUP($A2,$B:$C,1,0),"")
Type in cell E2 (column C5): =IFERROR(VLOOKUP($A2,$B:$C,2,0),"")
Autofill both formulas.
This will give you what you want, missing values will be shown as blanks. If you want concatenate both parts of out - just put the aggregate formula =ISERROR(...)&ISERROR(...) to any column row 2 you like.
Sample file: https://www.dropbox.com/s/qglyxmu3tkfxy7g/DataExtract2Cols.xlsx

Resources