I am using excel to store some data. The column stores some kind of output id which has to be in a certain format . The string should be in the format FP-2#-#### for example FP-22-1234 should be valid something like px423 should not be valid and the user should not be allowed to enter.
I know in SQL you can achieve this . How would I achieve this in excel
Thanks
Used conditional formatting and data validation but its not seem to be working
Try with LEFT, MID, RIGHT and ISNUMBER combinations as formula for custom Data validation..
Something like this (assuming that you're adding data validation to cell A1):
=AND(LEFT(A1; 4)="FP-2"; AND(ISNUMBER(VALUE(MID(A1;5;1))); AND(MID(A1;6;1)="-"; ISNUMBER(VALUE(RIGHT(A1; 4))))))
to make it a bit more readable (and understandable), multiline formula:
=AND(
LEFT(A1;4) = "FP-2";
AND(
ISNUMBER(
VALUE(
MID(A1;5;1)
)
);
AND(
MID(A1;6;1) = "-";
ISNUMBER(
VALUE(
RIGHT(A1;4)
)
)
)
)
)
I need help to write a code to return values for DF using the ID in the lookup table to fetch value that correspond to the latest date where there are duplications
Try a array formula, copy below formula and paste in cell B14 (i'm considering that "DATABASE" are in A1), and press Ctrl + Shift + Enter.
=INDEX(
$D$3:$D$8,
MATCH(
$A14 &
":" &
MAX(
IF(
$A14 = $A$3:$A$8,
$E$3:$E$8,
0
)
),
$A$3:$A$8 &
":" &
$E$3:$E$8,
0
)
)
I have a collection of tables with similar names: mytable1, mytable2, mytable3...
I need to create a VLOOKUP formula that uses one table or another depending of the value of a named cell ( Cell "A1" = rngChoice ) , for example:
If rngChoice = 1 then use mytable1
If rngChoice = 2 then use mytable2
If rngChoice = 2 then use mytable2
I could use the formula:
=IF(rngChoice=1;VLOOKUP("value";mytable1;"return column";FALSE);
IF(rngChoice=2;VLOOKUP("value";mytable2;"return column";FALSE);
IF(rngChoice=3;VLOOKUP("value";mytable3;"return column";FALSE) (...)
I can't use this formula because I may need to add or remove tables, so the formula should be changed every time, what's impossible to me.
What I need is something like:
=VLOOKUP("value";"mytable" & "table number";"return column";FALSE)
Use INDIRECT to return the range:
=VLOOKUP("value";INDIRECT("mytable" & "table number");"return column";FALSE)
I have a question regarding excel.
I have two columns, column A has a number and B has country codes. I'm looking for a way to automatically go through 100's thousands of rows to group them so they look like the following...
Is this doable? I'm at a complete loss :(
THE END RESULT
6512 AG,AI,AW,BB,BL,BM,
6513 BQ,BS,BZ,CA,CR
STARTING POINT - column A & B
6512 AG
6512 AI
6512 AW
6512 BB
6512 BL
6512 BM
6513 BQ
6513 BS
6513 BZ
6513 CA
6513 CR
These solutions use a working column named Concatenated Results.
Assuming your data has a header (adjust formulas as required) and is located at B6:C34 (change as required) as in fig below.
Data sorted by ID:
Concatenated Results: Enter this formula in D7.
= CONCATENATE( C7, IF( EXACT( B7, B8 ), "," & D8, "" ) )
ID.Unique: Enter this Array Formula in E7 (FormulaArrays are entered pressing CTRL+SHIFT+ENTER simultaneously, you shall see { and } around the formula if entered correctly)
=IFERROR( INDEX( $B$7:$B$34,
MATCH( 0, COUNTIF( $E6:$E$6, $B$7:$B$34 ), 0 ) * 1 ), "" )
Countries: Enter this formula in F7
=IFERROR(VLOOKUP(E7,$B$6:$J$34,3,0),"")
Copy range D7:F7 till last row of data (i.e. row 34).
Data not sorted: If the data is not sorted enter this formula for the Concatenated Results in D7. All other formulas remain unchanged.
=CONCATENATE( C7,
IF( ISERROR( MATCH( B7, B8:B$35, 0 ) ), "",
"," & VLOOKUP( B7, B8:D$35, 3, 0 ) ) )
Suggest to read the following pages to gain a deeper understanding of the resources used:
Excel functions (alphabetical), Create an array formula, Guidelines and examples of array formulas
Try this out and let me know in case of any queries or if you require detailed explanation.
Step1: Filter the data by column A.
Step2: Make a new column C where use this formula IF(A2=A1,CONCATENATE(B2,",",C1),B2) .
Step3: Make a new column D where use this formula IF(A2=A3," ","REQUIRED_ANS") .
Step4: Filter on column D using ALT + D + F + F and you get you desired output.
My Output:
This is a VBA solution
Assuming your data, excluding header, is located at B7:C34 (change as required).
ID.Unique: Enter this Array Formula in E7 (FormulaArrays are entered pressing CTRL+SHIFT+ENTER simultaneously, you shall see { and } around the formula if entered correctly)
=IFERROR( INDEX( $B$7:$B$34,
MATCH( 0, COUNTIF( $E6:$E$6, $B$7:$B$34 ), 0 ) * 1 ), "" )
Countries: Enter this User Defined Function (UDF) in F7
=Match_Concatenated(E7,$B$7:$C$34)
Copy this UDF code in a VBA Module
Option Explicit
Public Function Match_Concatenated(vValue As Variant, rTrg As Range) As String
Dim sOutput As String
Dim vTrg As Variant, vItm As Variant, lRow As Long
vTrg = rTrg.Value2
For lRow = 1 To UBound(vTrg)
vItm = WorksheetFunction.Index(vTrg, lRow, 0)
If vItm(1) = vValue Then sOutput = sOutput & Chr(44) & vItm(2)
Next
sOutput = Replace(sOutput, Chr(44), vbNullString, 1, 1)
Match_Concatenated = sOutput
End Function
Suggest to read the following pages to gain a deeper understanding of the resources used:
Excel functions (alphabetical),
Create an array formula,
Guidelines and examples of array formulas,
Option Explicit Statement,
Range.Value2 Property (Excel), For...Next Statement,
WorksheetFunction Object (Excel), INDEX function,
If...Then...Else Statement, Replace Function
I'm trying to setup an excel sheet that will have a drop down box in a cell at the top which will contain different worksheet choices that are available from my workbook. Once I choose a worksheet, I need this worksheet name to be referenced in many different excel formulas within this sheet.
Ex:
Choose an Application Group Filter: *Drop Down Choices* Recap Filter
PB Filter
Membership Filter
Formula:
=COUNTIF('DropDownChoice'!AA:AA, 8)
I also want to have multiple worksheets that have this drop down box available at the top.
Is this possible?
Use the INDIRECT() function
Example using your countif:
= COUNTIF( INDIRECT( CONCATENATE( dropdowncell, "!AA:AA") ,TRUE ), 8)
EDIT: Because you have space in your dropdown values you probably need
= COUNTIF( INDIRECT( CONCATENATE( "'", dropdowncell, "'!AA:AA") ,TRUE ), 8)