excel copying string found from cell one to a new cell - excel

I have a formulas that is currently only returning true/false, I wanted to improvise it instead of returning true/false, can I get the string that is found and copy it to another cell?
here is the formula that I use :
=NOT(NOT(SUM(--NOT(ISERR(SEARCH($D$2:$D$21;$B2))))))
thank you

Try,
=INDEX(D:D, AGGREGATE(15, 6, ROW(D2:D21)/SIGN(SEARCH(D2:D21, B2)), 1))

Related

Excel Range Editing

Hi I have a range in a cell made up by a formula resulting in "F1:F3".
I want to know how can I put this range into a new formula example:
=STDEV.P('SÉRIE 0516'!XXXXX)*SQRT(252)
Where on the XXXX should be the range on that cell "F1:F3" resulted by a formula.
My final resultu should be a formula:
=STDEV.P('SÉRIE 0516'!F1:F3)*SQRT(252)
Avoid the volatile INDIRECT by using INDEX():
=STDEV.P(INDEX('SÉRIE 0516'!$F:$F;$K$48):INDEX('SÉRIE 0516'!$F:$F;$K$49))*SQRT(252)
You can replace the $K$48 and $K$49 with the vlookups, but I think this will work for you.
Use this as a model:
=STDEV.P(INDIRECT("'SÉRIE 0516'!" & B1)*SQRT(252))
Here we use cell B1 as the reference.

Converting MATCH array formula to VBA code

I'm attempting to convert the formulas in a sheet into VBA code in a macro, and am stumped by the following:
{=IF(ISNA(MATCH($A8&$B8&$C8&E$7,'Raw Data'!$E:$E&'Raw Data'!$D:$D&'Raw Data'!$C:$C&'Raw Data'!$G:$G,0)),"","Yes")}
It's trying to look at multiple columns in one sheet, compare them to another, and see if the value of the column header is in the fourth column "G" to return "Yes" or blank. I've attached a screenshot of the sheet it fills out:
This array formula will take a long time to compute, since each column has over one million rows. Array formulas should not use whole column references.
The same result can be returned with a non-array formula, which can be used in VBA without any special commands.
=IF(ISNA(MATCH($A8&$B8&$C8&E$7,Index('Raw Data'!$E$1:$E$1000&'Raw Data'!$D$1:$D$1000&'Raw Data'!$C$1:$C$1000&'Raw Data'!$G$1:$G$1000,0),0)),"","Yes")
If you want to use an array formula in VBA, you will need .FormulaArray instead of .Formula or .FormulaR1C1
If you don't want to enter a formula into a worksheet cell, but perform the calculation in VBA, you can use Worksheetfunction (https://learn.microsoft.com/en-us/office/vba/api/excel.worksheetfunction) to use the worksheet functions and their syntax.

Three Dimension Vlookup

I have a master table with the following structure in excel :
How can I convert it as shown in the second picture by using the vlookup function? (function in yellow cells).
Three keys involved now: Daytime, User and Data Type (ADP_ERQ, ADP_SO)
Note: Column headers (Daytime, User, ADP_ERQ, ADP_SO) in the second picture are fixed.
Try this in C17 then fill right and down.
=INDEX($A$3:$Z$12, MATCH($A17, $A$3:$A$12, 0), AGGREGATE(15, 7, (COLUMN(1:1)+MATCH($B17, $1:$1, 0)-2)/($2:$2=C$16), 1))
For cell C17: IF(B17="USER_A",VLookup(A17,A3:C12,2,0),VLookup(A17,A3:E12,4,0))
For cell D17: IF(B17="USER_A",VLookup(A17,A3:C12,3,0),VLookup(A17,A3:E12,5,0))
In this formula replace A3:C12 and A3:E12 with your appropriate table range, then drag these down.

Excel VBA - Convert a string Formula to an Excel Calculation in a range of cells

I'm just wondering if this is possible to do without a loop - In my excel sheet, in, say, Range("A1:C10") I have text concatenation formulas that, once concatenated, create real Excel functions.
As a stupid example, suppose I had the following in cell A1:
A1: ="=Sum(D"&C2&":E"&C3&")"
Now, I know in VBA I can do something along the following for any one specific cell:
Range("A1").Formula = Range("A1").Text
And it will convert my text formula into an Excel formula and evaluate it.
Now, what I'm curious about is, whether there a way to say, for example:
Range("A1:C10").Formula = Range("A1:C10").Text
Without looping through each cell individually?
Also, I can't use INDIRECT() as, unfortunately, my formulas refer to closed workbooks :/
Any ideas??
Range.Text contains the string representation of the cell's value. The actual calculated value (which I suspect is what you're after) is accessed using Range.Value - try this:
Range("A1:C10").Formula = Range("A1:C10").Value
Not sure if this is what you are trying to do, but if for example you use:
Range("A1:C10").Formula = "=Sum(D1:E1)"
then the relative references will be auto adjusted:
A1: =Sum(D1:E1)
A2: =Sum(D2:E2)
B1: =Sum(E1:F1)
... etc.

Excel: Adding a row disrupts formula

In a spreadsheet I use for cash management tracking, I have the following formula:
=IF(D176="Cash", F175+C176, IF(D176="Transfer", F175+C176, F175))
When I add a row, I use control+D to fill in the formula from the cell above (I'm using Excel for Mac 2011). This results in the correct formula as follows:
=IF(D177="Cash", F176+C177, IF(D177="Transfer", F176+C177, F176))
However, this has the effect of changing the formula in the cell in the row below:
=IF(D178="Cash", F176+C178, IF(D178="Transfer", F176+C178, F176))
Here you can see the rows for column F are not correct: F176 should be F177.
Can anyone offer any advice to ensure that when I insert a row the formula remains intact?
Thanks.
Replace all of the references to F175 in the original formula (the one if row 176) with INDEX(F:F, ROW()-1).
=IF(D176="Cash", INDEX(F:F, ROW()-1)+C176, IF(D176="Transfer", INDEX(F:F, ROW()-1)+C176, INDEX(F:F, ROW()-1)))
'or better as
=INDEX(F:F, ROW()-1)+(OR(D176={"Cash", "Transfer"}*C176)

Resources