Write An If Then Else Function
Jul 26, 2009I'm wondering if an if then else function can be written for the problem that I'm having? Or is there a better way to accomplish this? I've detailed my problem within the example attached.
View 3 RepliesI'm wondering if an if then else function can be written for the problem that I'm having? Or is there a better way to accomplish this? I've detailed my problem within the example attached.
View 3 RepliesI have written a VBA program and using in Ms.Excel. The problem is when I try to write the VBA function through the function wizard it works but when I write the function in excel worksheet cell, it doesnt execute. I do not now the reason.
View 2 Replies View RelatedI have the following assignment to do, problem is I'm new to arrays and functions in VBA and nothing is working for me, i get errors no matter what i try, (for example i don't know how to feed the array to the function, and it won't let me write a range to an array)
5.A) Write a function that takes a 2D array of doubles, a single cell range, an optional cap and an optional floor.
B)Write the array on to the sheet with the single cell range parameter being the location of the top left of the array on the sheet. When writing the array to the sheet, for each value in the array where it is below the floor put the floor on the sheet, where the value is above the cap put the cap value on the sheet, otherwise display the original value. The input array should not be modified.
All code should be what you consider production quality.
Dim topleft As Range
array1 = Range("B8:C18").Value
'array1(1, 1) = 2
'array1(2, 1) = 3
'array1(1, 2) = 6
'array1(1, 3) = 9
'array1(2, 2) = 4
'array1(2, 3) = 5
if there is an Excel function out there that will copy over the contents of one cell into another by what is typed in another cell. Did that make sense?
Lets say that I have info in
(A1) John (B1) Smith (C1)X (D1)
Now I want to be able to copy over A1 & B1 to another part of the spreadsheet/workbook if I were to type the words "leave" into D1.
So basically it would look something like this...
(A1)John (B1)Smith (C1)X (D1)leave (want info to go here---->) (M4)John (N4)Smith (O4)currently on leave
And then have it automatically add the names below the one in M4-O4. so it would add names in M5-O5, M6-O6, etc
I have this spread sheet that has over 1000 names on it & it would help out alot if I could just use a function that could copy the information to another part of the spreadsheet or another workbook.
I know that I can use the filter, but I may want to have this stuff on another worksheet alltogether.
Also, if this is possible, is there a way that it can be automatically removed if I were to delete the word "leave" from the cell?
I'm trying to make a "weight-based" spreadsheet. I want to show a difference between numbers so if an item lost 5 lbs, there would be a "-5" and it would be in green font showing good.
For example, a box weighs 20 lbs and then drops down to 15 lbs. This would be a good result. So I would have 20 lbs in A4 and 15 lbs in A6 and I want to show the difference in A8. However, since I want the box to lose weight, I want it to show a negative value of "-5" in green font meaning it is good. And vice versa, I want it to show "+3" in red font if the box gained weight.
I can't really figure out how to get the signs working properly. I'm assuming to use an "if" function in where if the difference is a loss, show the negative sign and have it in green font. And if the difference is a gain, show the positive sign in red font.
how to write a custom made IFERROR function which works on Excel 2003 that mimics as closely as possible the Excel 2007 IFERROR function without using any array formula.
View 2 Replies View RelatedIn my spreadsheet, one user defined function i.e. pfizer is there which I want to convert into macro and use it in column H of sheet2 [sheets("sheet2").columns("H:H").select]
What should be the VBA code for this.
when I have started the macro with keyword as application. . the function is not populated.
-->I am able to populate the data with the formula like this = pfizer("I1")
Ihave this exel sheet i nedd function to write the starting date and time immediatly after i enter the name in the last colume ineed from exel to write the date and time emmideatly if the case is (done, cancelled ,or rejecteted)if the case is (select status )i want the cell empty but if the case is (pending)iwant to the program to calculte the deffirence between the ClosingDatetimee(which written by the program)and the delivering date(which entered manually by user)
View 9 Replies View RelatedColumnA Column B ColumnC (Yes/No)
2121 345766
23423 6456546
4234 6456456
7567 64566456
76756 654645
67567 3344534
76575 34534534
756756 45345
7657 534545
756767 4534534
756756 435345
Hello,
What I am trying to do is
Search the number written at ColumnB in ColumnA and if found write YES to column C
if not write No
I have a question, that could be answered by the experts in this forum. Question: I need to write the letter "E" in the second column (B) when I find that any cell in a row is in orange color (color 44). The code I wrote:
View 3 Replies View RelatedI basicaly need to look down column Q8 to Q52 for the falue "C19"
If that value is present - Then I need to look up the value of associated
with what is in its respective cell in column O8 to O52.
Then add them all together.
I have the formula that follows and it works, however it is huge. I have to repeat the IF,Vlookup 44 times. Just wondering if there is a better way.
Here is the formula I am using.
=SUM((IF(Q8="C19",(VLOOKUP(O8,clusterequipmentvalues,2,FALSE)),0)),
(IF(Q9="C19",(VLOOKUP(O9,clusterequipmentvalues,2,FALSE)),0)),
(IF(Q10="C19",(VLOOKUP(O10,clusterequipmentvalues,2,FALSE)),0)),
(IF(Q11="C19",(VLOOKUP(O11,clusterequipmentvalues,2,FALSE)),0)),
(IF(Q12="C19",(VLOOKUP(O12,clusterequipmentvalues,2,FALSE)),0)),
.... all the way to C52.
I have a checkbox that hides a range of columns when deselected and unhides the range when checked. I also want the code to write a value (1) to a cell when hidden and change the value to another value (0) when unhidden.
The range is hidden and unhidden perfectly, but the value "1" is written and doesn't change regardless of whether it is hidden/unhidden. (the value flicks momentarily to "0" when unchecking).
Code:
Private Sub cbTermPrev1_Click()
If cbTermPrev1.Value = True Then Range("Term_Prev1").EntireColumn.Hidden = False
Range("HiddenValPrev1").Value = 0
If cbTermPrev1.Value = False Then Range("Term_Prev1").EntireColumn.Hidden = True
Range("HiddenValPrev1").Value = 1
End Sub
Write a formula with a cap of 125%
A
B
C
D
1
x
y
z
2
Commission
1000
1000
500
[Code] .......
How to write the formula to know how much commission with be paid out for x,y,z?
Excel is a new program for me sorry to say it but i have been try to figure out how to write a schedule on it and tally the hours for each employee i have them set up in rows right now and i hope i can keep it that way but i am tired of add hours up for each employee every week i'm sure it is really easy but can some one let me in no the little secret
View 9 Replies View RelatedI recived the small job of making a template for my company for travel. I had spare time so I added in a feature so they can just e-mail it to the approite person from clicking a command button intead of taking the time to click the built in excel e-mail function and typing the addresse.
Anyway, this from tells the person who it is being e-mail to, what flights to book.
I have differnt command buttons to bring up differnt airline webpages, bascially a hyperlink but in command button form. Is there a way, just because i have time, to take the flying dates from excel, input them into the webpage which the command brings up, and search for the flights for that date, just by clicking a button in excel?
I am using excel VB for the little code I have
i have accumulated a lot of data on an excel sheet now i need to be able to run 2 reports that will spit out the data in a specific way but i have no clue but i have made a word document to show how i would like it to spit out
View 9 Replies View Relatedneed to write this forwula for excel 1000((value from cell)+.256)=(((x+.314)1000)+9)1.0625. I would like to plug in a value from a cell and find the comparative value x. I am comparing the airfregiht cost between two carriers that have different surcharges for fuel, secuirty, and tax. One has no security or tax.
View 4 Replies View RelatedI am having some trouble setting up an excel spreadsheet. I dont know alot about this kind of thing so if it comes out confusing i apologise.
what i need to do is the following:
1. I need to have a cell which holds a range of data for example between 7.5 and 7.99, then the next cell 8.0-8.49 etc. How would I go about doing this?
2. I then have 2 tables side by side. on the first table i want to be able to write a number in, say 7.6, and once i enter this number i need in the second table for it to have sorted which of the above fields it fits into. I know you can have colours for each field, and that is the way i would identify which data range it fell into.
I need to have the counter to count every row consecutively, but to write the consecutive number in the first cell in every fifth row.
F.e. A$1$ should have the number 1 but A$6$ should have the number 2 and so on.
I was given the code below which works for "sheet1",but when adapted it to write to sheet repairs as well, nothing writes to sheet "repairs", have tried different codes that works writing to 1 sheet , but am having trouble writing to both sheets from a macro,i know it can be done
[Code] .....
I have one cell that contains a function. Sometimes I want to change the value in the cell because the value is used in another function in the sheet.
The problem is that I want the function to reapear in the cell when I press the deletebutton.
Exampel:
1. Cell A1 contains this function.
=Sumproduct((part_number>100)*(Price>10);Stockvalue)
This returns a value that is used in other cells in the sheet.
2. Now I want to try what happens in the other cells if the value in cell A1 is changed.
I select cell A1 and writes the new value that I want to test.
3. If I want the function back I simply should select cell A1 again and press delete.
4. A VBA macro now writes the original formula back into Cell A1.
Is there a more convenient way to write something like this:
View 2 Replies View RelatedI managed to write my script with pretty much the info I could find on the forums (yes!) but I need to write my data to the last row. Columns A - D of the last row will be populated with the content of my variables. This little snipped gives me the first empty row:
View 5 Replies View RelatedOk I have these ini files for a access control system. We have 40 different systems. All on different databases. that look like the following: ...
View 6 Replies View RelatedI'm trying to learn VBA programming (I started some years ago already, but felt it was a bit too difficult for me) and I would like to ask two (perhaps very basic) questions:
1 - Can someone give me a code which does the following : In A1 I have a string : "This is a test." I want it in rewritten in column C1-4 as follows :
C1 This
C2 is
C3 a
C4 test.
2 - A code which does the following : In A1 I have a word : "Testing"
I want it this word as split up in 1 character/cell as follows :
C1 T
C2 e
C3 s
C4 t
C5 i
C6 n
C7 g
I want to write the following worksheet function in VBA. In cell B1 : =IF(OR(A1={1,2,3,4,5,6,7,8,9,0}),"Yes","No").
View 3 Replies View RelatedAt attachment when we enter value to f11 and h11 together, certificate number must be come up in cell of f13
View 14 Replies View Relatedbeen trying to do some more sophisticated charts in my excel sheet. I would like to be able to write some formulas, e.g divide one arnge with another and show the result in the graph.
View 2 Replies View RelatedI have this code:
Private Sub TextBox135_Change()
On Error Resume Next
TextBox138.Value = Format(CDbl(TextBox135.Value) / CDbl(TextBox86.Value), "0.0000")[code].....
It suppose to take one input and calculate for the other variables the problem is that once it writes the outputs the other text box it activates the second text box code so I keep getting the error "13" and the result is the same no matter what number I put.
My Columns are as follows:
A1-Criminal Name, B1-Crime, C1-Age, D1-Ratings, E1-Punishment
In the punishment column one will get 22 years life imprisonment if he fulfills the following conditions.
1. He must have done Rape OR Murder
AND
2. His Age should be >30
AND
3. His Ratings should be>8
It should throw 22 years in the Punishment column only if the above conditions are met otherwise it should be Nil.
More Info on this:
1. Crime column includes Murder, Rape, Robbery, Assault, Kidnap etc
2. Age column ranging from 22-75 years.
3. Ratings column ranging from 1-10 points
4. There are 3400 records we have in the list
How to write an IF AND OR combination formula for this ?