Hello I am trying to write a macro that compares two columns and tells me if something from the first column does not exist in the second.
A B
1 55
23 68
55 97
68 58
97 90
14
25
So I need to take the values from A and check if they are present in B, if not it shopuld give back the value from A which was not found.
Can you please help me on that
You do not need vba.
This formula will do what you are asking.
=IFERROR(AGGREGATE(15,6,$A$1:INDEX(A:A,MATCH(1E+99,A:A))/(ISERROR(MATCH($A$1:INDEX(A:A,MATCH(1E+99,A:A)),B:B,0))),ROW(1:1)),"")
Put it in the first cell of the desired output and copy down till it returns blanks.
Related
I will try to reword this bc I still have had no luck:
I have a workbook with 2 different tabs:
REPORT_TAB and
RAWDATA_TAB
My RAWDATA_TAB has standard database looking data in it like this:
A | B | C | D
ACCOUNT_KEY | AMOUNT | DATE | FEES
MGX4421 100 6/15/2018 26
MGLR200 75 6/15/2018 5
CXDSTR 150 6/15/2018 50
18000 45 6/15/2018 10
On my REPORT_TAB, I simply want to search column A above for specific accounts, and return the value in column B. For example:
For one cell I want to search for "CXDSTR" and return 150
For another cell, I want to specifically search for acct "MGX4421" and return 100
I thought I could accomplish that with something like:
=VLOOKUP("MGX4421", RAWDATA_TAB!A1:D10,2,0) which would return me 100, but it just says #N/A with the green triangle in the cell
Any help? Would this be possible with VLOOKUP, or easier with VBA? or MATCH/INDEX
Thanks in advance for the help!
I was able to find a solution for this. I couldn't get the VLOOKUP to do exactly what I was trying to do, so I used the INDEX-MATCH combo. Syntax looks like:
=INDEX(RAWDATA_TAB!A1:T1000,MATCH("MGX4421",RAWDATA_TAB!C:C,0),2)
This basically goes to the RAWDATA_TAB, searches for the row which contains the unique account number "MGX4421" and returns the column "2" which in the above example is the [AMOUNT].
I hope this helps anyone
Hi I am very new to Excel VBA
I want to change row and column values
My data is similar to this
My age is My height is My weight is
between 10-20 150 45
between 21-30 170 56
between 10-20 155 60
between 10-20 160 53
between 21-30 173 68
I want to make the data like this
Age Hght Wght
Category A 150 45
Category B 170 56
Category A 155 60
Category A 160 53
Category B 173 68
ie I changed the first row
Then I changed all "between 10-20" to "Category A" and "between 21-30" to "Category B"
I prefer not to use column numbers in code, instead I prefer to use column names.
ie like this,
If Age="between 10-20" then Age="Category A"
How can we do it?
First of all, make sure you put the data in the table. (not simply type in the data in the excel's cells) You should go to INSERT ribbon there insert the table.
Next, follow the advice from #Bryon, create another table called "DataTable" like following figure. You may create this table at another worksheet (e.g. MyData)
Lastly, you create another table called "MyResult". At the 1st row of the table, put the formula in the cell as following based on the columns :
=VLOOKUP(AgeTable[#[My age is]],DataTable,2,TRUE)
column 2
=VLOOKUP(AgeTable[#[My Height is]],AgeTable[#[My Height is]],1,TRUE)
column 3
=VLOOKUP(AgeTable[#[My Weight is]],AgeTable[#[My Weight is]],1,TRUE)
Following is the output of the table:
Whenever values had been change at column 2 and column 3 of table 1, it will change the column 2 and column 3 of table 3
Hi I am new to VBA script. I have the following problem.
Sheet 1
Date Sum of cnt
01-04-2014 77
01-06-2014 3
01-07-2014 2
01-08-2014 1
01-09-2014 921
Sheet 2
Date count (count/sumofcout(sheet1)
01-06-2014 3
01-09-2014 4
01-09-2014 712
01-07-2014 1
01-08-2014 1
01-09-2014 205 .....
I have to search for the every single date from sheet 1 if there is match in sheet 2 , corresponding count(sheet2)/sum0fcount of that date(sheet1) should be my third column in sheet 2. Please anyone help me. I have large data multiple values of each day in a month.
Thanks in advance.
As Tim has suggested in his comment above...you can use Vlookup/Match (along with SumIF) to get your results. A formula like this (with different ranges) should do the job:
IF( ISNA(MATCH(A2,Sheet1!$A$2:$A$13,0)),"",B2/SUMIF(Sheet1!$A$2:$A$13,A2,Sheet1!$B$2:$B$13))
You can change the Ranges A2:A13, B2:B13 to adjust this according to your data
I have two excel wordbooks. One has parameter changes on certain dates and the other has dates on which the juice has been produced. Like this
Spreadsheet 1
date of parameter change %apples %oranges
30/09/2014 55 45
25/09/2014 50 50
20/09/2014 45 55
Spreadsheet 2
date of the created juice %people that liked it %apples %oranges
26/09/2014 88
22/09/2014 91
And I want to copy the % parameters of apples and oranges into the second workbook so that the result looks like
date of the created juice %people that liked it %apples %oranges
26/09/2014 88 50 50
22/09/2014 91 45 55
So basically if a juice is made on 26/09 for example then I want to have the parameters that were used for that juice. Obviously the parameters of 30/09 weren't used but the parameters of 25/09 were used because it's the day before the juice has been made.
Is it possible to create something like this with VBA? Could anyone show me how to do the date searching part at least? It would be so much appreciated!
You can use a VLOOKUP formula for what you would like to do rather than using VBA.
The syntax of a VLOOKUP is as follows:
VLOOKUP(lookup_value, table_array, col_index_num, [range_lookup])
To find an approximate match to the value that you are looking for, you can set the range_lookup parameter to TRUE
If you cannot change the sort order of the information in Spreadsheet 1 then a slightly more complex INDEX(MIN(INDEX())) function pair would do.
The standard formula in G2 is,
=IFERROR(INDEX(B$2:B$4, MIN(INDEX(ROW($1:$3)+($A$2:$A$4>$E2)*1E+99,,))),"")
This can be copied or filled both right and down. The IFERROR wrapper shows a blank cell when there are no dates that match your criteria (as in 19-Sep-2014 in the image supplied). The sample as produced on a single worksheet for demonstration's sake but the two tables could in in different worksheets or even different workbooks.
If date of parameter change is in Book2 Sheet1 A1 and date of the created juice is in A1 then in C1:
=VLOOKUP($A2,[Book2.xlsx]Sheet1!$A:$C,COLUMN()-1)
copied across and down may serve provided the date order in Book2 is reversed and both sheets are open at the same time (or the full path would be required).
I have a calendar excel sheet that has week number and month numbers, but it also has ID fields for week and month. So I have week 1 which has 7 days in it with each date having a week ID of 40. If I try the auto fill to drag down it ends up going 40.1, 40.2 or some things similar. Don't use excel often. Is it possible to get it to just repeat the ID for the Week? (for example every 7 days a new id is generated?)
Thanks
Nice trick to get repeated value x times, then increase value by 1 and repeat x times, ... is to use rounded-down division of row numbers:
=INT((ROW() - row_offset) / nr_of_repeats) + initial_value
e.g. values for following formula:
=INT((ROW() - 2) / 7) + 40
A1 Header
A2 40
A3 40
A4 40
A5 40
A6 40
A7 40
A8 40
A9 41
A10 41
...
Replace ROW by COLUMN or relative reference to a cell with Day_ID as appropriate.
It might be a good idea to replace the formulas with (Paste special) values after you compute the correct numbers..