I have 2 excel sheets, sheet A
Column A | Column B
12ABC Value1
14AZC Value2
44AXC Value3
73XBC Value4
and second sheet
Column A | Column B
BC Value5
14AZC Value6
44A Value7
I need to make vlookup on Sheet1 with data from Sheet2.
The problem is that I need to use only partial string from Sheet2, as there may be more than 1 possible way to match both values. In result, I would need result:
Column A | Column B | Column C
12ABC Value1 Value 5
73XBC Value4 Value 5
I tried with, but I need it the other way around
=IF(NOT(ISBLANK(A2)); VLOOKUP(A2 & "*"; Sheet2!$A$1:$B$40;2;FALSE))
If you want to use VBA it's very simple:
Public Function FindOcc(Base As Range, Serc As Range) As String
For Each x In Serc
If InStr(Base.Value, x.Value) > 0 Then
FindOcc = x.Offset(0, 1).Value
Exit Function
End If
Next
End Function
Otherwise you can use the a Hidden Column for each data in the sheet2. Following the scheme:
Use the formulas:
E3 -> =F3&G3&H3
F3 -> =IFERROR(IF(FIND($A$10;A3);$B$10;"");"")
G3 -> =IFERROR(IF(FIND($A$11;A3);$B$11;"");"")
H3 -> =IFERROR(IF(FIND($A$12;A3);$B$12;"");"")
...
and autocomplete...
In the column E you have the result...
Related
I have in excel something like:
A B
1 Value1 10
2 Value2 20
3 Value1 5
4 Value1 10
5 Value2 15
How I can sum for given value in A? For example, having something like this:
6 C D
7 Value1 25 (sum of b1+b3+b4)
8 Value2 35 (sum of b2+b5)
Of course, how can I do this automatically and not manually.
Thanks very much.
Let's assume you have a list of the unique values in column A listed in column C, i.e.:
Row A B C
1 Value1 10 Value1
2 Value2 20 Value2
3 Value1 5
4 Value1 10
5 Value2 15
In column D, the following formula will count the occurences of each value in column C:
=SUMIF(A$2:A$6, "=" & $C2, B$2:B$6)
This should be pasted into D2 and then copied to D3, D4, etc.
The result will look like:
Row A B C D
1 Value1 10 Value1 25
2 Value2 20 Value2 35
3 Value1 5
4 Value1 10
5 Value2 15
How does this work? SUMIF allows criteria to be used, and if satisfied, a SUM of the cells is taken. In this case, the SUMIF does this:
Looks in cell range A$2:A$6
Compares the value in each cell to see if it is equal to $C2 (or $C3, etc dependent upon which row is being calculated)
If it is equal, sum the value from the cell range B$2:B$6
Limitations
In order for this to work, the unique values in column A must already be known and listed in column C. There are some ways of generating a list of unique values but they are not straight-forward. Roll on UNIQUE which ships with the new version of Office.
There are different ways to do this:
Use a pivot table (as already mentioned in the comments).
Use a SumIf() worksheet function (as mentioned in another answer). This, however, will only work if you know all names (like Value1, Value2, ... (the list MUST be limited))
Use subtotals. This, however, will only work when you sort first.
Write a VBA macro.
How can I move values from Worksheet 1 column B to Worksheet 2 column B, based on a unique ID in column A? Some IDs are duplicates and some values are empty, I would like to ignore empty values.
Worksheet 1:
A B
23452 value1
23452
53252 value2
67452 value3
Worksheet 2:
A B
53252
23452
67452
Wanted Result (Worksheet 2):
A B
53252 value2
23452 value1
67452 value3
What I have tried
Merging data in Open/Libreoffice calc - could not figure this out for my specific requirements.
You can try this simple INDEX-MATCH formula,
In column B of sheet2,
=INDEX('Sheet1'.A:B;MATCH(A1;'Sheet1'.A:A;0);2)
I have below 2 sheets.
Sheet 1
id review_name
1 Test1
2 Test2
3 Test3
Sheet 2
Review_name Date_range
Test1 B2:B248
Test2 AC2:A248
Test3 U2:U248
Here the Date_range refers to column names in sheet3.I should pick the review names and based on the above date_range(column range) of sheet 3,i should look for matching value.
Expected result
Col1 Col2 Col3
1 test1 LOOKUP(1,Sheet3A2:A248,<Here i should use sheet2 lookup date_range>
Any suggestions, i used concatenate of sheet name and the range, like LOOKUP(1,Sheet3A2:A248,Sheet3&B2:B248) but dint work
You'll need function =INDIRECT() to convert a string holding a sheet/range name into an actual range. Otherwise it just stays as a string which is meaningless. In your case something like:
=lookup(A1, Sheet3!A2:A248, indirect("Sheet3!" & vlookup(B1, Sheet2!A:B, 2, false)))
That last parameter of your lookup function is going to concatenate the string Sheet3! to the results of the vlookup, which will be the string range in Column B of Sheet2. That is then interpreted by indirect() into an actual range that will function in your lookup() formula.
I have an Excel table whose unique key is the combination of Para1, Para2 and Para3:
Para1 Para2 Para3 Value1 Value2 Value3
A B C 1 2 3
A E F 4 6 4
A B C 5 3 7
P Q R 4 2 4
I want to find the duplicates and SUM the values, so the expected output is:
Para1 Para2 Para3 Value1 Value2 Value3
A B C 6 5 10
A E F 4 6 4
P Q R 4 2 4
Is there a way to group the data get the SUM?
You could copy the columns 1,2 & 3. Then remove the duplicates and put a SUMIFS function in the Value columns.
Assuming Para1 is in A1, insert a column on the left that concatenates the key elements:
=B1&C1&D1
and copy down to suit. Sort your data by that column and apply Subtotal At each change in: Para1Para2Para3, Use function: Sum, Add subtotal to: check Value1, Value2, Value3, Replace current subtotals and Summary below data, OK.
Filter ColumnA, Text Filters, Contains..., tot, OK. In B4 enter:
=B3
copy across to D4 and B4:D4 down to suit. (Select All) in ColumnA, select all cells, Copy, Paste Special..., Values, OK over the top. Filter ColumnA again to select Does Not Contain..., tot, OK and delete all visible except the labels. Delete ColumnA and last row. Select all cells and in Subtotal select Remove All.
I have an excel file in which i have two sheets. Sheet 1 named "cert" which is a certificate which retrieves and displays value from sheet 2 (lets say sheet 2 as Oct). Sheet 2 "Oct" is like following:
MT MMBTU
Date1 value1 value1
value2 value2
value3 value3
Date2 value1 value1
value2 value2
value3 value3
Each day have 3 values each and it will continue till the last date of the month.
And my sheet 1 "cert" which retrieves value from sheet "Oct" looks like following:
MT: value 1 value2 value3
MMBTU: value 1 value2 value3
Sheet "Oct" have formula for finding MMBTU from MT. So each time a value is entered in MT, MMBTU will appear in respective cell. My issue here is as the MMBTU coloumn has formula in it, zeros will be appearing in each cell and when MT value is entered, zero will replaced by value. In sheet "cert" i am retrieving last entered values for MT & MMBTU. Values for last entered MT is appearing correctly but for MMBTU it is displaying zero because the coloumn from which the value are being retrieved has been already filled with zeros from the formula (formula which converts MT to MMBTU). How to fix this?
Assuming MT: is in A1 and Date1 is in A2, maybe in B2 and copied across to D2:
=INDIRECT("Oct!"&ADDRESS(MATCH(LOOKUP(1E+100,Oct!$B:$B),Oct!$B:$B,0)-4+COLUMN(),3))