Evaluating A String As A Formula
Apr 20, 2009
Is there a way a string can be evaluated as a formula?
I'm building a formula by concatening several strings but can't find a way to evaluate the formula.
Do I need a macro or is there a simple way to eval it?
View 5 Replies
ADVERTISEMENT
Mar 7, 2008
I have a formula which works (to the extent that it returns a value), but if I try to use the Evaluate Formula function, it fails at the first step, returning the "=name?" error. The formula does contain a number of named ranges, but these do not appear to affect it's function.
=IF(AND(PBREQ="NO",SEAS_PBREQ="NO",C8="P",F8="DML"),WORKDAY(EXWORKS,(VLOOKUP(E8,DISTINCREMENTTABLE,7,FALSE)*-1),HOLIDAYS),IF(AND(PBREQ="NO",SEAS_PBREQ="NO",C8="P"),WORKDAY(EXWORKS,(VLOOKUP(E8,INFINCREMENTTABLE,7,FALSE)*-1),HOLIDAYS),IF(AND(VLOOKUP(D8,ITEMTABLE,14,FALSE)="Y",C8="P",WORKDAY(H8,VLOOKUP(D8,ITEMTABLE,I8,FALSE),HOLIDAYS)
View 9 Replies
View Related
Jun 5, 2009
Can somebody have a look at the workbook that I've attached.
I have set up a timeshhet calculator for work but the thing is, the hourly rates of pay are dependent upon the day of the week the Operative is working, and the time of the day.
We split the shifts AM & PM and the rates are decided as per the worksheet contained within the workbook "Rates".
The problem I am having is how to get the timesheet to understand the days.
For example, if an Op works the Sat night or Sun night, then the rate should reflect x1.5. If it's Sat/Sun daytime, then it's x1.25.
Again, and as per the "Rates" sheet (see top for the rate multiplier) Mon - Fri 09:00 - 17:00 is flat rate/standard hrs. If the work Mon - Fri evenings, then the rate is x1.25.
How can this be done?
View 10 Replies
View Related
Sep 5, 2013
My purpose is to compare date fields in two worksheets and have the formula tell me if the dates match. I took care to make sure the dates were true date using =datevalue()
=IF(B2=VLOOKUP(B2,'Raw Data'!$J$2:$K$9748,1,FALSE),"Match","NoMatch")
First, it returns #N/A
Second, I used the formula one column over to evaluate invoice numbers and it worked though in the few that did not match it returned #N/A and not NoMatch.
=IF(C2=VLOOKUP(C2,'Raw Data'!$J$2:$K$9787,1,FALSE),"Match","NoMatch")
View 3 Replies
View Related
Aug 6, 2008
I am trying to loop through some rows within a worksheet in an effort to make sure the values match a list of values that are defined in an array. However, when I get to the IF statement, I always get a 'Type Mismatch' error.
Dim varRetailers
varRetailers = Array("Depot", "Lowes", "Sears", "TSC", "Walmart", "Z-Other")
For c = rowDataStart To rowDataEnd
If Cells(c, colRetailCat) varRetailers Then '
View 9 Replies
View Related
Oct 31, 2009
HI can't seem to get this last scenario laid into this if statement. I am having trouble with the second statement. I need the three cells to equal 100, but only when all three are filled. If only two as in this scenario I would like % Error in cell G2.
Sheet3 *DEFG250%50%*O.K.Spreadsheet FormulasCellFormulaG2=IF(SUM(D2:F2)=0,"",IF(AND(OR(ISBLANK(D2),ISBLANK(E2),ISBLANK(F2)),SUM(D2:F2))=1,"% Error",IF(OR(D2>E2,F2>E2,SUM(D2:F2)1),"% Error",IF(SUM(D2:F2)=1,"O.K.",IF(AND(E2>D2,E2> Excel Jeanie HTML 4
View 9 Replies
View Related
Oct 30, 2007
If Not IsEmpty(ActiveCell.Value) And ActiveCell.Value >= 4050 Then
The code in the above if statement is running when I hit a cell with no contents. When there is no such cell, it works fine. I've tried using "" as well but the same thing happens.
View 9 Replies
View Related
Nov 25, 2008
Sheet 1 to look into Sheet 2
> Find a certain string "name1" > if string is name, copy succeeding columns if not goes and checks another cell till it finds it.
> Then copied columns will be evaluated (sum, divide, etc)
this loops through all rows.
next problem i am seeing is what if it finds 2-5 names how can i combined all the cells copied?
View 9 Replies
View Related
Sep 17, 2013
I am working on a customer report template that generates our customers reports and will send them out automatically.
This issue I have now is that the system that generates the raw data for these reports only lists the Customers name in a column with an entry for each line of data, the thing is though that the system has lots of variations of the customers name, even more so if that customers has different departments.
What I need to do is from this list of customer names, I need to automatically figure out what the "common" name is or main name so to speak, and then make a variable using the correct full name, which will be used later on in the code to import correct logos, and direct the reports to the correct people.
Here is a quick example of what data we get raw from the system:
Customer Name:
John Build
Johns Buildings
Johns Ltd Building
Johns Plumbing Department
Glass Doors Ltd A Department of Johns Buildings
Johns Building Corporation
Hole In One Golf Range
This is just an example, we have thousands of clients, so the length, number of words etc can change alot. Ideally I from a list similar to that I would get a full proper result of "Johns Buildings Ltd" for example, this would then be in a variable to be used in code from then on to reference doing certain things with the reports of Johns Buildings Ltd.
You'll notice there is one name "Hole In One Golf Range" that seems to have no relation at all, this is correct, ideally I would also like to build in some error checking into the code, so that rows like that that have nothing to do with the others would get deleted.
So how would you amazing VBA gurus go about working with data like this? I'd prefer a more general answer with explainations that just straight code, as I'm sure I will have to adapt the hell out of it for it to be useful in context.
View 9 Replies
View Related
Mar 22, 2007
I have a formula in a string, like "5,6889*0,11^3 ..." and I would like to insert it as a formula into a cell or just to get the result into a variable. I have tried
ActiveCell.FormulaR1C1 = "=" & String Or
ActiveCell.FormulaR1C1 = String (With the equal sign already In the String)
but it doesnt work.
When i do it manualy - select the cell in excel, put the egual sign in and paste the formula it works.
View 3 Replies
View Related
Aug 17, 2009
Does Excel have any 'built-in' ability to interpret a string as a formula, or would I need to implement a VBA function? In it's simplest form I am thinking of something along the lines:
Cell A1 contains: 5
Cell A2 contains: "*100"
Cell A4 contains: =Evaluate(A1 & A2)
and hence displays 500
I know evaluate doesn't work, but is there something that does this?
View 4 Replies
View Related
Nov 15, 2013
The table below is a portion of a calendar to track vacation and sick time. What I am trying to do is add all the hours of vacation ("V") and sick ("E") time that an employee has used in a cell at the end of each row which represents a month. So there are 31 cells that I need to look in and if it contains V... sum in the vacation cell. There may be a space after the letters and there may not be. They can also start with a decimal.
month
1
2
3
4
5
Vacation
Sick
January
E8
V8
V.5
V6.25
E .5
Sum of V (should be 14.25)
Sum of E
View 6 Replies
View Related
Apr 3, 2014
For whatever reason, I don't succeed to write a formula with a string to a cell using vba The char(10) is not accepted
Code:
LimitGainLong_.Formula = "Limit" & CAR(10) & "Profit: " & LimitProfitLongGain
View 5 Replies
View Related
Oct 2, 2007
I have a formula in VB code that is like this
sheet1.cells(irow,asktimecol)=asktime
when i place the cursor over each element i get :
irow="9"
asktimecol="5"
asktime="13:30:00"
so it reads
sheet1.cells("9","5")="13:30:00"
but iget the the error
application defined or object defined error
this is saying it cant place the asktime to cell
I have to bring the time thru as string as it come thru as one
View 9 Replies
View Related
Sep 16, 2009
if it is possible, to use a string variable in a Formula via VBA.
For example: ActiveCell.Formula = "=SUM(Sheet3!strVariable)"
Of course the code is not working that way. The Variable has the following structer: CellAdress;CellAdress;CellAdress... so it would perfectly fit into the formula-syntax.
Is there any possible way to do that? The reason behind it is, that I have to deal with a flexible range and I want to process this range with a formula. Actually the range is flexible, because of different filters and I only wanna count all numbers in the unhidden rows.
My varibale would then contain all celladresses, for the visible cells.
So in a nutshell: is it possible to somehow use a varible in a formula?
View 9 Replies
View Related
Apr 21, 2006
Just a quick question, is it possible to use a string variable in a Excel formula (in VBA)? Im trying to do the following in VBA
mortgageSchedName = acName & " Schedule"
Range("B6").FormulaR1C1 = "=mortgageSchedName!RC[254])"
the above results in an error because there is no such sheet as "mortgageSchedName", but I want it to access the value of that string variable.
View 6 Replies
View Related
Jul 6, 2006
I'm having problems with small macro I'm writing.. I'm very close to finishing it but I'm stuck at the end by an extremely small/basic error. What I wan't to do is take a Formula that was generated in a loop and is stored in a string and to output it to a cell on my worksheet as a working formula...
View 9 Replies
View Related
Dec 23, 2008
I'm using Excel 2007. I want to write a formula that will list all characters in a string to the left of a "-". See below example. What formula would I use?.......
View 2 Replies
View Related
Feb 21, 2009
Cell A1 contains 012345678 ** Customer of 987654321 **
Cell B2 contains 087654321
My formula =MID(A1,FIND("of",A1)+2,10) works perfect if it has a "customer of...". How to revise my formula that when it gets to cell B2 and if there is no "** Customer of ..." it would leave it blank or zero rather than #Value!?
View 3 Replies
View Related
Sep 22, 2009
i have attached an example to illustrate the data source and result expected.
View 3 Replies
View Related
May 19, 2009
I am using the following code to read a formula as a string. But sometimes the use r may forget to enter formula in the particular cell. In this case I want to check if the first character of the string is a Equal-to Sign (=). In case it is then macro proceeds further otherwise a message prompts user to enter a formula first. how to check if the first character of the string is a '=' sign?
View 5 Replies
View Related
May 20, 2009
how to use a formula or macro or whatever that is applicable to solve my current issue.
For example:
I've the following text below. The prefix of "atest", "bgo", "crun" and "dfly_c" are fixed pattern, however, the text after prefix will change accordingly.
atest_myhomeisfar
bgo_runfast
crun_b:veryfast
dfly_c:bluesky
Now my request is, I would like to have the final output as per below. Notices that there are some additional numbers behind the text (with semicolumn).
Final output:
atest_myhomeisfar:1998
brun_veryfast:2009
cfly_bluesky:1790
dfly_c:bluesky:1800
My question is, is it possible to create something to handle this issue? I mean something that will seach thru a particular fixed pattern as mentioned above and add the number behind it?
I would like to do it one at the time (one prefix at a time). Not mass searching and adding.
For example:
Search all "atest*" pattern and add an additional number behind.
View 14 Replies
View Related
Feb 19, 2012
I have the following in VBA:
Code:
ActiveCell.FormulaR1C1 = _
"=mod_a1&"" ""&mod_b1&"" ""&mod_c1&"" ""&mod_d1&"" ""&mod_e1&"" ""&mod_f1&"" ""&mod_f1&"" ""&mod_g1&"" ""&mod_h1&"" ""&TEXT(mod_i1,""m/dd/yyyy"")&"" ""&mod_j1&"" ""&TEXT(mod_k1,""h:mm:ss"")"
I only want the user to see the string, not the concatenation formula. So how do I get VBA to turn this formula into an actual string.
I have seen some functions using ByVal and Evaluate with this sort of thing but this is just different enough that I can't figure it out.
View 4 Replies
View Related
Mar 9, 2012
How do you replace a string in a Formula within a cell or several cells?
For example:
=SUM(Sales[Monthly])
find and replace Monthly with Quarterly
View 2 Replies
View Related
Jan 16, 2013
I'm getting the generic 1004 error on the Range.FormulaR1C1 line, but I can't seem to see the problem.
Code:
Sub UpdateFormulas()
Dim stockFund As String
For i = 2 To finalRow
[Code]....
The mouse-over on the stockFund variable in that last line shows the correct cell address as the value and I checked the If statement to ensure it actually finds the number. I would guess that it would be a syntax error with that line, but it looks correct to me.
View 8 Replies
View Related
Aug 23, 2013
How can I transform a text string into a formula. ='F1'!$C$2
This appears as a text and I want to convert it to a formula exactly like it's written. I made this formula like this because I need to get the value from 1000 sheets. So I use the formula to change the sheet number automatically.
But now I can not convert the text into a real formula.
I know that I could do it with a macro but I prefer to do it without using a macro.
View 5 Replies
View Related
Jul 23, 2014
I have been trying to work out a formula without success so far. If you look at the this text string
Code:
Depart Doncaster Depot with a Mini bus at 0649
The "Mini" word in red is the one that I am trying to work out with.
Here is the problem. The "Mini" word could be replaced with 7 other words - Walk, Artic, Dart Smart, Maxi, Smart, Staff Car, or just bus with no explanation as to what type it is.
I need a formula to look at the text string and work out which one of the above categories are included in the text and based on that gives me either W, A, Dart Smart, Mx, S, Car, and the last to be just N.
View 9 Replies
View Related
Dec 8, 2006
What formula can I use to extract this string text.
I need to be able to extract the name after "and"
I would like to extract the name Lana from:
View 9 Replies
View Related
Jul 18, 2007
What formula can I use to search a range of cell values for a specific text string? My method is searching formulas instead, which is not what I want.
Background: I am developing a little test script for a project and I want to include some automatic validations to help make the job of the testers easier.
What I have set up so far:
1. Testers input numbers into specific fields M8 through M20.
2. Fields N8 through N20 automatically check fields M8 through M20 and compare those with what is contained in a range of hidden cells I set up in advance. A formula ensures that it reports "correct" or "incorrect" on a field-by-field basis, based on the comparison.
3. Cell O8 searches for the text string "incorrect" in cells N8 through N20. If that text string appears in any one of the cell values (not formulas), then O8 directs the tester to test again. If the text string "incorrect" does not appear, then cell O8 reports that the test was successful, and the tester can proceed to the next test (exact same setup repeats).
My only problem is in the formula used for the last step. I have tried a few different formulas I know in cell 08, but none are giving me the results I'm looking for. The closest I have come is a successful search and validation based on the string being in the formula instead of in the value of the given cell.
View 9 Replies
View Related
Oct 16, 2007
I'm trying to put a formula into a group of cells with VBA. However, the formula requires quotation marks in it...e.g.,
the formula in the cell should be... = "STR - " & intRow
where intRow will insert a designated integer. My problem is the quotes for the string part....I can't get the VBA code (tried both setting a string variable and using range.value =) to keep the needed quotes.
View 9 Replies
View Related