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

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

Related

Fill blank cell in Excel with value with same ID

I'm not so advanced in excel I need help if is it possible to do.
I have an excel with this column:
ID - Value1 - Value2
I need to update the value1 (or value2):
- only if are blank AND only if the row has the same ID
I make an example, I have this table:
ID Value1 Value2
A1 1 100
A2 2
A3 3
A4 1 200
A5 2 250
Iwould like to fill all the empty cell in this way
ID Value1 Value2
A1 1 100 200
A2 2 250
A3 3
A4 1 100 200
A5 2 250
Thank you for any help.
Ok, so your data is a mixture of numbers and texts. You can generate two new columns with the desired values using formulas. Choose two new, adjacent columns, say D and E, and enter this CSE formula in row say in cell D2:
D2:
=IFERROR(IF(ISBLANK(B2),INDEX(B$2:B$99,
MATCH(1,($A$2:$A$99=$A2)*(1-ISBLANK(B$2:B$99)),0)),B2), "")
CtrlShiftEnter
Enter the formula in D2 with CtrlShiftEnter and then copy/paste in the cells of columns D and E (or as I said any two adjacent columns).

Excel. Convert text to values and calculate the values in a formula

I want to convert text to values and then with this values calculate a result:
Text "A" is always = 8
Text "B" is always =7
In my sheet:
In cell A1:"A" and in B1: "B". Now in cell C1 I want the sum of A1 and B1 (8+7=15).
I always want the cells A1 och B1 to show text not values.
And if it possible I dont want any intermediate cells that convert A1 to 8 and B1 to 7 so the resultformula points at that intermdediate cells. I want my result (C1) to calculate the text cells directly. Is this possible?
=IF(A1="A",8,IF(A1="B",7,NA()))*IF(B1="A",8,IF(B1="B",7,NA()))
It is easier to have a separate translation list, say on Sheet2 cells A1:B6:
A 8
B 7
C 6
D 5
E 4
F 3
and then use:
=VLOOKUP(A1,Sheet2!$A$1:$B$6,2,FALSE)*VLOOKUP(B1,Sheet2!$A$1:$B$6,2,FALSE)

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

formula for finding the first non-empty cell

I have a spreadsheet with 2 columns of data, column A and B, and column C where I'm looking for the formula.
row A B C
1 50
2
3
4
5 56 6
6
7
8 46 10
9
10
11 64 18
As you can see, a row either contains a value or not. In column C, I'm looking to calculate the difference between
a) the value in column B and the value in column A's first non-empty cell directly above (so for example, at row 5, I calculate the difference between B5 and A1 56 - 50 = 6) if the value of B is a number and
b) the value in column A and the value in column B's first non-empty cell directly above (row 8, 56 - 46 = 10)
and put nothing if neither column A and B are empty.
I've been struggling with "first non-empty cell" to write an R1C1 formula. Note that I know I can do this in VBA but I'm looking for the R1C1 formula.
Thanks for your help.
Here is an array formula (that you need to validate with Ctrl + Shift + Enter) you can put in C1 and drag and drop till the end of your data:
=IF(OR(A1<>"",B1<>""),INDEX($B$1:B1,MAX(IF($B$1:B1="",0,ROW($B$1:B1))))-INDEX($A$1:A1,MAX(IF($A$1:A1="",0,ROW($A$1:A1)))),"")
Or, in a french version of Excel:
=SI(OU(A1<>"";B1<>"");INDEX($B$1:B1;MAX(SI($B$1:B1="";0;LIGNE($B$1:B1))))-INDEX($A$1:A1;MAX(SI($A$1:A1="";0;LIGNE($A$1:A1))));"")
Note that if you feel interested, you can commit into Stackoverflow in french
Perhaps try this formula in C2 copied down
=IF(B2="",IF(A2="","",LOOKUP(9.99E+307,B$1:B1)-A2),B2-LOOKUP(9.99E+307,A$1:A1))

Resources