Formula Excel Vlookup - excel

I have my main sheet.
Account Card
1 22
1 33
Same person has 2 cards. Hence, the balance is same.
Vlookup sheet has data like below.
Account Balance
1 5
When I do the following:
=VLOOKUP(A2,DATA!A2:B84520,2,FALSE)
It returns value for first Account 1. and N/A for second.
Account Card Balance
1 22 5
1 33 #N/A
How can I fix the formula?
Thanks

Put $ in A$2:B$84520. Try.
Best
Anderson

Related

Subtotals grouped by value using COUNTIF to create ranges for SUMIF, but in a single formula

End-goal: A column with the subtotals of groups (defined in the below table as all foods listed above Zucchini, incl Zucchini).
Current attempt: create a column to define groups using COUNTIF('count all 'zucchini' thus far'). Then use SUMIF to get the total cost for the current group.
Problem: I don't know how to do this without the COUNTIF column (since SUMIF needs range C:C to be resolved first). I'd like to have it in a single formula. I looked into array formulas but not sure if/how to apply that here.
FOOD COST COUNTIF(A2:A$2;"Zucchini") SUMIF(C:C;C2;B:B)
Apple 3 0 12
Pecan 7 0 12
Zucchini 2 0 12
Apple 4 1 23
Olive 8 1 23
Pecan 6 1 23
Zucchini 5 1 23
Apple 4 2 16
Olive 9 2 16
Zucchini 3 2 16
Any ideas on how to solve either the current problem or the end-goal problem? Thanks!
Put this in C2 and copy down:
=IF(A2="Zucchini",SUM($B$1:B2)-SUM($C$1:C1),"")
It basically sums everything to the row and subtracts what is already accounted for.

Sum the maximum values based on criteria Excel

The objective is to calculate the total allowance for the kids in my data set that are aged 12+. In this example using the data set below, the outcome should be 9 (5+2+2). Can someone please help me with a formula? Thanks!
ID Age Allowance
Fred 12 6
Fred 15 10
Fred 18 5
Joe 12 2
Sam 12 2
DJ 10 1
With Office 365 Excel:
=SUMPRODUCT(SUMIFS(C:C,A:A,A2:A7,B:B,">=12",B:B,MAXIFS(B:B,A:A,A2:A7))/COUNTIFS(A:A,A2:A7))
If one does not have Office 365 Excel then one can use a helper column and sum that.
In D2 Put:
=IF(AND(B2=AGGREGATE(14,7,$B$2:$B$7/($A$2:$A$7=A2),1),B2>=12),C2,"")
And copy down. Then sum at the bottom.

VBA macro to combine two sheets on unique id

I have two sheets in Excel workbook.
The first sheet has
1) Customer ID – unique values for each customer.
2) Question ID – unique id for each question
3) Questions
Customer ID Question ID question
1 34 name
1 45 company
2 34 name
2 45 company
3 34 name
3 45 company
4 34 name
4 45 company
5 34 name
5 45 company
The second sheet has three columns
1) Customer ID – unique values for each customer.
2) Question ID – unqiue id for each question
3) Questions
Customer ID Question ID Answer
1 34 Amy
1 45 GEICO
2 34 Steph
3 34 Anna
3 45 GEICO
4 34 Adam
5 34 Mark
5 45 AAA
In this sheet, not every customer id and Question ID in sheet one will have answers in the sheet 2
Sheet 3 Expected Output
I wanted to do a vba macro to combine both sheet1 and sheet2 and have all the columns. For any customer id, if there is no answer for a question, that field should be left blank.
Expected Output in Sheet3
Customer ID Question ID question Answer
1 34 name Amy
1 45 company GEICO
2 34 name Steph
2 45 company
3 34 name Anna
3 45 company GEICO
4 34 name Adam
4 45 company
5 34 name Mark
5 45 company AAA
There are several ways this can be done without writing code.
Below is one method off the top of my head. Others include the built-in query editor (Get & Transform), or PivotTables and others ways to consolidate data in multiple worksheets.
On Sheet2, first set up a "helper column" since there are multiple columns you want to match. In this example the formula is: =C2&D2 starting in Cell B2.
...then, in Sheet1 (cell E2 in the example), use a formula like:
=IFERROR(VLOOKUP(B2&C2,Sheet2!$B$1:$E$9,4,FALSE),"")
Both formulas get copied or "dragged" down as far as necessary and obviously the formula adjusted to refer to the correct cells.
No third worksheet is necessary but if you want you can start by copying Sheet1 to Sheet3.
More Information:
Microsoft Support : VLOOKUP Function
Microsoft Support : Lookup & Reference Functions
Microsoft Support : IFERROR Function

Excel VBA to find non unique values with multiple conditions

I am looking for some help trying to create an excel macro. I have a very large sheet that look a bit like this:
Account NAME Address Dealer
68687 Sara 11 Wood 1111
68687 Sara 11 Wood 1111
68687 Sara 11 Wood 1111
12345 Tom 10 Main 7878
12345 Tom 10 Main 7878
54321 Tom 10 Main 7878
10101 John 25 Lake 3232
10101 25 Lake 3232
11111 John 25 Lake 3232
What I need to do is to highlight all the rows on the sheet where each Dealer has more than one unique value in the Account column, but it must also have some value in the name column.
So in the above example I would only want to highlight all the rows for dealer 7878.
I am not certain if I should look at loops or arrays, they might take a long time as the sheet is quite large.
Looking for some help.
Thanks.
James - Dirk gave you a good answer in his comment. It looks like this ...
The format formula is also put into Column F, so you can see the results of the calculation.
If you feel you should still have a VBA solution, this gives you a good starting point for how to layout your code ...
Ignore rows with empty name
Count rows where the dealer is the same as the dealer in the current row, and the account is NOT the same as the account in the current row
If the count found in Step 2 is greater than 0, highlight the current row.

multiple conditions in =sum

Phone number Provider Duration (min)
1001 Fastcom 2
1002 Fastcom 1
1004 Mobilecom 4
1008 Telecom 5
1001 Fastcom 3
1001 Fastcom 2
1003 Telecom 3
1004 Mobilecom 2
1008 Telecom 6
1002 Fastcom 1
I want to use one formula to get the sum of the duration of calls whose service provider is the provider for the phone number 1001. I hope this revised version is clearer than the previous one. Again, thanks to all who paid attention.
There are 14 rows. Column A contains numbers from 1 to 14. Column B contains Names of people(maybe repeated). Column C contains their preferred seasons (possible more than 1) and Column D contains how many days they do sports in that partucular season. I need one formula to get how many days are spent doing sports in the season(s) that is (are) preferred by Adam, which actually are Spring and Fall
Assuming data in rows 2 to 15 try this array formula
=SUM(IF(ISNUMBER(MATCH(C2:C15,IF(B2:B15="Adam",C2:C15),0)),D2:D15))
confirmed with CTRL+SHIFT+ENTER
In one formula I'm not sure. Personally I'd have a formula in each row of column E that is 0 or the value from D, then you can sum(e:e) instead.

Resources