Excel - vlookup value - combination of2 columns (without concat) from another sheet [duplicate] - excel

This question already has answers here:
Vlookup using 2 columns to reference another
(2 answers)
Closed 1 year ago.
I want to write kind of formula (look-up) where i can match and bring data from another sheet using combination of 2 columns without concatenation. I am doing using following formula at the moment:
+VLOOKUP(A1&B1,'other_sheet'!A:D,4,0)
where Colomn A in other sheet in concat of B1 and C1 (B1&C1)
However, my intention is to to get same result without doing any concat as you can see in below pic:

You could try:
For microsoft365:
=FILTER(G$2:G$9,(E$2:E$9=A2)*(F$2:F$9=B2),"")
Drag down. Or if you don't want to drag down the formula and BYROW() is available:
=BYROW(A2:B6,LAMBDA(a,FILTER(G2:G9,MMULT(--(E2:F9=a),{1,1})=2)))
For older versions of Excel try:
=INDEX(G$2:G$9,MATCH(1,INDEX((E$2:E$9=A2)*(F$2:F$9=B2),),0))
Or:
=LOOKUP(2,1/((E$2:E$9=A2)*(F$2:F$9=B2)),G$2:G$9)
Drag down.

In your example, you can do:
=INDEX('other_sheet'!D:D, MATCH(A1&B1,'other_sheet'!A:A&'other_sheet'!B:B,0))
where 'other_sheet'!A:A, 'other_sheet'!B:B, and 'other_sheet'!D:D might also be a range like 'other_sheet'!A1:A100, 'other_sheet'!B1:B100 and 'other_sheet'!D1:D100.

Related

How to reverse order of cell text seperated by "/" in Excel/Google Sheet [duplicate]

This question already has an answer here:
Convert text date to date in Google Sheets
(1 answer)
Closed 17 days ago.
As you can see in the image below, I have a column with values like this:
10/1/1399
11/1/1399
23/2/1400
16/12/1390
1/1/1400
and I want to re-order them to be like this:
1399/1/10
1399/1/11
1400/2/23
1390/12/16
1400/1/1
Sheet Image
is there a way to do that either on MS Excel or Google Sheet?
Within sheets, you can also try:
=INDEX(REGEXREPLACE(TO_TEXT(A2:A6),"(.*)/(.*)/(.*)","$3/$2/$1"))
Try:
=ARRAYFORMULA(BYROW(QUERY(SPLIT(A1:A,"/"),"select Col3, Col2, Col1"),LAMBDA(row,TEXTJOIN("/",1,row))))
In Excel:
=BYROW(A2:INDEX(A:A,COUNTA(A:A)),LAMBDA(r,TEXTJOIN("/",,INDEX(TEXTSPLIT(r,"/"),{3,2,1}))))
Assuming input is actual text, representing a date, two options that worked for me in GS:
Formula in B1, results may be locale settings dependent:
=INDEX(TEXT(DATEVALUE(QUERY(A:A,"Where A is not null")),"yyyy/m/d"))
Formula in C1:
=INDEX(REGEXREPLACE(QUERY(A:A,"Where A is not null"),"(\d+)(\/\d+\/)(\d+)","$3$2$1"))
For Excel, the 1st option won't work because it's a date prior to 1-1-1900 (AFAIK). What could work is:
=MAP(TOCOL(A:A,1),LAMBDA(x,TEXTJOIN("/",,INDEX(TEXTSPLIT(x,"/"),{3,2,1}))))
the most efficient way would be to make a macro that does this as a one column operation, but the easiest way I could think to do it is to separate the cell into columns delimited by the slash, and then concatenate them in reverse order and add the slashes back.

Excel Formula to add text/word to a percentage result [duplicate]

This question already has answers here:
Concatenate percentages in Excel
(2 answers)
Closed 2 years ago.
I have a formula in 1 cell
=(A6-B6)/B6
Which results to -0.105243123560658in cell C6. A6 has the new sales amount and B6 has the old sales amount. I'm trying to get the result formatted like:
Difference is 10%
I have 2 problems
How to get the decimals turn into non-decimal number (I'm already researching on this)
How to add a text/word to a calculation result like adding "Difference is " to the (A6-B6)/B6 calculation result.
This I have tried to research and the only solution I can find involves using additional cells. Is there a way to do this with using only 1 cell ($C$6)? I tried
="Difference is "&(A6-B6)/B6
but I'm getting Difference is -0.105243123560658 instead. Also tried:
="Difference is "&($B$6-$C$6)/ABS($C$6)
You need the TEXT function:
="Difference is "&TEXT(ABS(A6-B6)/B6,"0%")

Excel formula to extract multiple matching values [duplicate]

This question already has an answer here:
INDEX and SMALL only returning one result
(1 answer)
Closed 7 years ago.
I'm looking for what I thought would be a pretty straightforward formula to compile a list of names based on a criterion. For example, I would have a list of 50 employee names in column A and then a "Y" or "N" next to each name in column B. I would then like to have another tab on the spreadsheet list the names of everyone with a "Y" value in column B. I dont want empty rows between the names in the list on the new tab (this is why I haven't had success with IF statements). I also would like to avoid manually filtering out blank rows.
Lets say your first sheet is Sheet1
on Sheet 2 on a1 enter:
=IF(ISERROR(INDEX(Sheet1!A:A,MATCH("Y",Sheet1!B:B,0))),"",INDEX(Sheet1!A:A,MATCH("Y",Sheet1!B:B,0)))
On a2 enter:
=IF(ISERROR(INDEX(INDIRECT("Sheet1!A"&MATCH(A1,Sheet1!A:A,0)+1&":A50"),MATCH("Y",INDIRECT("Sheet1!B"&MATCH(A1,Sheet1!A:A,0)+1&":B50"),0))),"",(INDEX(INDIRECT("Sheet1!A"&MATCH(A1,Sheet1!A:A,0)+1&":A50"),MATCH("Y",INDIRECT("Sheet1!B"&MATCH(A1,Sheet1!A:A,0)+1&":B50"),0))))
And just drag the 2nd formula down.
Note that I assumed your first sheet is with 50 Rows as you wrote, Otherwise additional modifications needs to be made.
The formula you are looking for is quite complicated and requires cyclic calculation. For this reason, it is not advisable to use for long lists of several hundred or thousand 'names' but a list of 50 names should pose no discernible difficulties.
With the names in Sheet1's A2:A51, use this formula in the worksheet destined to receive the Y names.
=IFERROR(INDEX(Sheet1!$A$2:$A$51, AGGREGATE(15, 6, ROW($1:$50)/(Sheet1!$B$2:$B$51="Y"), ROW(1:1))), "")
Fill down as necessary. Note that the AGGREGATE¹ function is returning the position within A2:A51 with ROW(1:50).
Retrieving the non Y names should be a simple matter of changing the primary condition to (Sheet1!$B$2:$B$51="N") or (Sheet1!$B$2:$B$51<>"Y").
For pre XL2010 circumstances, this standard formula performs the same filtered retrieval.
=IFERROR(INDEX(Z!$A$2:$A$51, SMALL(INDEX(ROW($1:$50)+(Z!$B$2:$B$51<>"Y")*1E+99, , ), ROW(1:1))), "")
¹ The AGGREGATE function was introduced with Excel 2010. It is not available in earlier versions.

Excel - Freezing a formula [duplicate]

This question already has an answer here:
Monitor cell value and copy it to another cell
(1 answer)
Closed 8 years ago.
I am trying to create a spreadsheet, where on one sheet I have data (to which I will add a new row with new figures each week) and on another sheet, a summary of the most recent 4 weeks using =SHEET1!B4:C4 as a formula (for example).
How can I lock that formula so that (in Sheet 1) when I add a new row for a new week, the formula doesnt adjust to =SHEET1!B5:C5?
To lock a formula against a row, column, or cell, use the $ before the row/column. =SHEET1!$B$4:$C$4 will lock both row and column, if you just need to lock the rows, then use =SHEET1!B$4:C$4.
Alternatively, you can name the range (in your case a single cell), see here: http://spreadsheets.about.com/od/exceltips/qt/named_range.htm
Edit:
Following your comment I think I understand. You will need the OFFSET function anchored to the latest datum.
See the is walk through: http://excelsemipro.com/2010/10/the-offset-function-last-7-data-points/
and this tutorial shows more info
To Lock data:
=SHEET1!B4:C4
should be replaced with
=SHEET1!$B$4:$C$4
Here's some further notes: http://blogs.msdn.com/b/rextang/archive/2007/06/07/3136694.aspx

SUMIF in a closed workbook

I got the following working formula:
={SUM(SUM.IF(
'Sheet1'!$B:$B;
IF(INDEX(List;;MATCH($D$4;Month;0);2);INDEX(List;;1);0);
'Sheet1'!$H:$H
))}
I would like to make it working if the ranges (Sheet1) are actually in a closed workbook. I found the following article:
http://support.microsoft.com/kb/260415
I don't know where to start to make it working assuming B:B and H:H are in another workbook.
D4 is the current month, Month is a list with the 12 months and List is composed of 2 zones, the first one with unique IDs that I need to compare with the B:B range and the second zone with 12 booleans columns telling me if I actually want to consider that ID for the desired month.
If I just convert it using the Microsoft KB, the following won't work (#N/A! error if entered as an array formula and I just get the total number of lines of the sheet if I enter it as a normal formula):
={SUM(IF(
'[myFile.xlsx]Sheet1'!$B:$B = IF(INDEX(List;;MATCH($D$4;Month;0);2);INDEX(List;;1);0);
'[myFile.xlsx]Sheet1'!$H:$H;
0
))}
After #barry houdini's answer, here are the exact formulas I have (still a little bit simplified). The second one (his answer) doesn't give me the exact same number because it does add up the numbers in the H columns where the B column is empty (even if List doesn't have any empty rows).
Working
=SUM(SUMIF(
'April'!$B:$B;
IF(INDEX(List;;4;2);INDEX(List;;1);0);
'April'!$H:$H
))
Almost working
=SUM(
IF(
ISNUMBER(
MATCH('April'!$B:$B;IF(INDEX(List;;4;2);INDEX(List;;1);0);0)
);
'April'!$H:$H
))
Your problem is that Excel doesn't know how to compare a whole column...
'[myFile.xlsx]Sheet1'!$B:$B
to a differently sized list, i.e. that returned by
IF(INDEX(List;;MATCH($D$4;Month;0);2);INDEX(List;;1);0)
Try using MATCH to do that, i.e.
revised as per comments:
=SUM(IF('[myFile.xlsx]Sheet1'!$B:$B<>"",IF(ISNUMBER(MATCH('[myFile.xlsx]Sheet1'!$B:$B;IF(INDEX(List;;MATCH($D$4;Month;0);2);INDEX(List;;1);0);0));'[myFile.xlsx]Sheet1'!$H:$H)))
or alternative.....(see comments) which avoids the extra IF
=SUM(IF(ISNUMBER(MATCH('[myFile.xlsx]Sheet1'!$B:$B;IF(INDEX(List;;MATCH($D$4;Month;0);2);INDEX(List;;1);"");0));'[myFile.xlsx]Sheet1'!$H:$H))
confirmed with CTRL+SHIFT+ENTER
MATCH returns a number (when there's a match) or #N/A so when you wrap that in ISNUMBER you get a list of TRUE/FALSE values as required.
Note: this will probably be slow using whole columns B and H (SUMIF will only use the "used range", this will use the whole column) so, if you can, I recommend using a more limited range
I'm guessing that list and months are named ranges in the closed workbook. This being the case you cannot reference named ranges in a closed workbook. Convert your use of List and Month to actual cell references in the closed workbook.

Resources