So I have two columns of data and I want to add a date next to data that has two sets of values. So if A3 = Trucks and B3 = 2008 appear in the two columns I want C3 to have a date value of 11/1/2016. If these values A3 = Trucks and B3 = 2008 appear anywhere else in the data I want the date value to increase by 1 to 11/2/2016 and have that run until the data is fully queried.
This is what i understand from your question
if A3 = Trucks, B3 = 2008, C3 = 11/1/2016. then
if A10 = Trucks, B10 = 2008, then C10 = C3 +1 i.e. 11/2/2016
if my understanding is right, the below formula should work. Here is a google spreadsheet.
IF(MAX(--($A$1:A8=A9)*--($B$1:B8=B9)*ROW($A$1:A8))>0,OFFSET($C$1,MAX(--($A$1:A8=A9)*--($B$1:B8=B9)*ROW($A$1:A8))-1,0)+1,"New Date")
Please note the formula is an array formula i.e. press Ctrl+Shift+Enter after typing in cell. Also I have added an if clause, in case the item is appearing for the first time in the list, it will show "New Date".
Related
I am using Excel 2016 and have text in another language in column A (currently French but could be another in another spreadsheet) and I want to put a formula in e.g. cell B1 which will translate cell A1 and show the result in B1. I then want to drag the formula down (if possible) so then this formula translates each cell in column and puts the result in the corresponding cell in column B e.g. B2 will have the translation in English for A2 and B3 will have the translation for A3 and so on...
Is this possible?
To answer your question:
"Yes"
...it is definitely possible.
I need a VBA for the whole column B and A says that
if Value of Cell B2 did not change then A2 value will be the same
if B2 value is changed then A2 value will increase by one
Use this formula.
Put your staring number in A1.
Put this in A2:
=IF(B2<>B1,A1+1,A1)
And copy down.
I want to compare 2 columns in excel and highlight duplicates in both. But there are two problems here:
1- I want this comparison to be case sensitive
2- I want to highlight the first occurrence only
It will be great if the script has 2 scenarios:
First: It highlights duplicates at both columns and between them too so the result should be like
In this case:
1) Highlight duplicates within column A, column B, and compare A and B columns to find duplicates too
2) Whenever it find duplicates it highlight ONLY first occurrence of it
Description:
A1 = kar32 > It is duplicate with A3 and it's the first occurrence
A5 = mic > It is duplicate with A6 and it's the first occurrence
A8 = fab > It is duplicate with B3
A9 = tea > It is duplicate with A11 and it's the first occurrence
B1 = kar32 > It is duplicate with A1
B2 = mic > It is duplicate with A5
B3 = fab > It is duplicate with A8
B4 = Fat > It is duplicate with B6 and it's the first occurrence
Second: It highlights first occurrence duplicates between both columns and ignores the only duplicates in the same column
In this case:
1) Highlight ONLY duplicates between columns A and B and ignores duplicates found in the same column
2) Whenever it find duplicates it highlight ONLY first occurrence of it
Description:
A1 = kar32 > It is duplicate with B1 and it's the first occurrence
A5 = mic > It is duplicate with B2 and it's the first occurrence
A8 = fab > It is duplicate with B3 and it's the first occurrence
As you see, it ignores to highlight A9 = tea, B4 = Fat because they didn't have duplicates in other column
Use conditional formatting.
One caveat, row 1 needs to be blank or titles that are not in the list being tested.
Select A2 and manage rules. Add a formula rule. Then add the following formula:
=AND(OR(SUMPRODUCT(EXACT($A:$A, A2)*1) > 1,SUMPRODUCT(EXACT($B:$B,A2)*1)>0),SUMPRODUCT(EXACT(A$1:A1,A2) *1)= 0)
Then change the "applies to" to the entire range of cells in column A.
Repeat for column B, but use the following formula:
=AND(OR(SUMPRODUCT(EXACT($A:$A, B2)*1) > 0,SUMPRODUCT(EXACT($B:$B,B2)*1)>1),SUMPRODUCT(EXACT(B$1:B1,B2) *1)= 0)
I need a function that will do what Excel does automatically when you dreag a formula: change the referneces automatically.
For example:
In A1 I have "= A2 + A3"
If i copy this to say C3 it will have: "= C4 + C5"
I need to WRITE a formula in C3 that will produce this.
Any ideas? VBA solution is also welcome
CLARIFICATION:
In need this to be as general as possible.
Meaning A1 can contain ANY formula of any type, containing references to other cells.
for example: "= A2 + A3" or "= VLOOKUP(A2, $C$1:$E$7, 2, True)"
In need to move have this formula, whatever it is, copied to another cell (say C3), w/o the built in copy/paste, and have the references (that aren't set with $) change relatively.
I thought there might be a function to write in the destination file to do this.
I have tried writing an Eval function, and i managed to copy the formula from A1 and have it evaluated in C3, but the references would not change
This question lacks a bit of clarity, but I think this might be what you're after:
=SUM(OFFSET(C3,1,0,2))
This will sum the two cells directly below the given cell (in this case, cell C3). That is, it offsets C3 by 1 row, 0 columns, and grabs a height of 2 cells and then passes the result to the SUM function.
This VBA code would do what you are looking by setting the formula in the active cell:
ActiveCell.FormulaR1C1 = "=R[+1]C+R[+2]C"
You can use the Indirect() function using relative reference style.
For example, if you were in A1 and wanted to sum B1 & C1, it would look as follows:
A1: =INDIRECT("RC[1]",0)+INDIRECT("RC[2]",0)
That will change as you move the cell around to always sum the 2 cells to the left of the cell.
For your specific example (A1 = A2 + A3 || C3 = C4 + C5), it would be as follows:
=INDIRECT("R[1]C",0)+INDIRECT("R[2]C",0)
Hope that does the trick!!
I am going create a macro to convert two number to a range, e.g.
On excel cell A1 and A2, I input integer 1 and 5 respectively. The output will look like:
A3 1
A4 2
A5 3
A6 4
A7 5
How can I do that?
You can accomplish this without even using macros :)
in A3 type your first number.
On the Home tab go to the Editing section > Fill > Series...
Choose to have your series populated in Columns. Choose a stop value of 20 (or whatever)
Click OK
Now you will have a series of numbers 1-20 going down starting in Cell A3.
You can change your step value so that each number is incremented by 1, or 2 or 3 or whatever. You can also fill in rows instead of columns.
If you need it more automated than that just do all of that while recording a macro and see what it does then change the VBA to suit you more specific needs/come back here with some code to get advice on.
The Below COde will read the Content from the A1 and A2. According to the range it will display the result in the A series only.
enter code here
For i = Cells(1, 1) To Cells(1, 2)
Cells(1, i + 2) = i
Next i