I am wondering if there is any way to create a cell that automatically updates to the next in a series in Excel.
If Column 2 contains any of these:
2A
2B
2C
Then the cell would say use 2D next. And then when that column shows 2D, then use 2E, and so on. I have tried using an if function, but I can't seem to get it to work. I plan on having the list of available entries on a separate worksheet that the data will draw from.
Thank you in advanced!
You could try this:
Have the text "2A" in cell A1.
In cell A2, paste this formula:
= LEFT(A$1,LEN(A$1)-1)&CHAR(CODE(RIGHT(A$1,1))+ROWS(A$1:A2)-1)
And drag down as necessary.
EDIT
Based on your comment, you can modify cell A2 to this:
= IF(RIGHT(A1,1)="Z",(LEFT(A1,LEN(A1)-1)+1)&"A",
LEFT(A1,LEN(A1)-1)&CHAR(CODE(RIGHT(A1,1))+1)
Related
I'm currently having a problem finding a way to vba an excel formula for all my columns in a worksheet. The number of rows in this worksheet is set to change from use to use hence it has to have a variable range.
The table currently looks like this:
I've got the value for noOfRowsOfData using:
Worksheets("Posttrans").Range("A1").Select
noOfRowsInPosttrans = Selection.CurrentRegion.Rows.Count - 2
The formula I am trying to put at the bottom of the table is:
=IF(noOfRowsInPosttrans=COUNTIF(A3:A688,A2),TRUE,FALSE)
Where 688 is set to change to noOfRowsInPosttrans
This will keep it dynamic. I'm just wondering how I would go about inserting the formulas displayed.
Any help would be great!
Thanks,
PineappleBeans
A6 = "=IF(COUNTIF(A$3:A5,A$2)=(CELL("row",A6)-3),TRUE,FALSE)"
Copy A6 to B6
EDIT: getting kind of crazy, but to show the formula:
Function function1(zcell As Range)
function1 = zcell.Formula
End Function
Then A8 = "=function1(A6)" and B9 = "=function1(B6)" gives
I am stuck...
I have a 100 Row sheet with 10 Columns. This list is broken into classes simply by inline headers. I have definitions of the blocks of data under each head, for example:
UNASSOCIATED A2 A19
HOSTS A21 A32
ROOF A34 A100
I compute those ranges as they may change from time to time. I need
first: Define Name of each group by formula
Second: From time to time select the defined group
I am unable to get a formula to work which will allow me to use the "Content" of the cell as opposed to the cell location to define these ranges.
I'm stuck.
Suggestions would be appreciated.
Regards,
RHD
This cannot be done in a cell formula. You'll need to create a macro (VBA) to do this. Essentially, what you need is to grab the value of a cell then use that value as if it were a cell address.
Take a look at the example macro below. If cell A1 contains the characters "B22", then x will become the value of A1 (which is "B22") and "test" will be written to cell B22. This cannot be done in with cell formulas.
Sub test()
Dim x As String
x = Range("A1").Value
Range(x).Value = "test"
End Sub
A good amount of adaptation will been needed to incorporate this technique, and you'll need to play with this a bit. Ping this community to help answer more specific questions as they come up.
I have some problem in using If Excel function. I want to use range in excel. So when my data is in range, it will show something. I use this formula but it doesn't work "
=IF(E11=Rekap.C8:C21, VLOOKUP(Rekap.C8:C21, Master.A2:C148, 3), "")
Form that formula, if data in E11 is same like data in range C8 - C21 in Rekap sheet, it will show another data in Master sheet that in range A2-C148 column 3. How can I use range in if formula ?
A single cell like E11 cannot be compared to a range like C8:C21.
I assume that you really want to check if the value in E11 appears anywhere in the range C8:C21 and if so, perform the lookup. That can be done in several ways
=if(isnumber(match(e11,Rekap!$C$8:$C$21,0)),vlookup(E11,Master!$A$2:$C$148,false),"")
Note that I added the fourth parameter to the Vlookup. It will default to TRUE if omitted, which may return wrong results if the lookup table is not sorted.
I am using a countif function to check if I need to use autofill, but I encountered a problem where my raw data had two entries but these were merged together in my destination sheet. I can't use a form of unique count if as when these cases occur, they will not have the same reference anywhere, but are linked. Is there a way to countif on my destination sheet under the header?
If WorksheetFunction.CountIf(wksdata.Range("D:D"), "MAN002") > 1 Then
wksdestination.Range("B6:R6").AutoFill Destination:=wksdestination.Range("B6:R" & Lastrow)
End If
This caused the macro to break as it was trying to autofill to the bottom of the sheet, a count of cells from A6 down would be ideal, A5 has a title in it, A3 has the word "Month" and A1 and A2 are merged to form A1:L1 and A2:L2 respectively.
Realised I was doing something complicated when there was a really simple solution. Check if A7 has data.
If wksdestination.Range("A7") <> "" Then
facepalm
So for example let's say we have a Data Validation drop down in sheet Main in cell B2 using Barney, Jack, Moe.
In C2 I want a cell that displays a number.Sheetname based on the Data Validation.
Barney = 1.Main
Jack = 2.Main
Moe = 3.Main
How would I do this?
If I do =CELL("address", b2) it will give me 2
I am assuming that "Barney","Jack","Moe" is just an example. You may have a longer list? If yes, then for this you have to first create the data validation appropriately.
For demonstration purpose, I am placing your list G2,G3,G4 and then selecting them and giving them a name.
Next create the data validation in cell B2 as shown below.
Put this formula in cell C2
=IFERROR(INDEX(MATCH(B2,Names,0),1,1) & ".Main","")
and you are done :)
In C2 enter:
=LOOKUP(B2,{"Barney","Jack","Moe"},{1,2,3}) & ".Main"