Reducing Number Of If Statements In Code
Sep 3, 2006
i have a simple if statment
If cboname.Value = Sheets("Data Sheet"). Range("E2") Then
txtpay.Value = Sheets("Data Sheet").Range("F2")
End If
this need to be done for a large list of names and input into another sheet. what i wanted to know was if there is a quicker way of doing this code without repeating the code loads of times
View 9 Replies
ADVERTISEMENT
Mar 30, 2007
I would like to take a date and reduce it to single number. Eg.
Reduce the day to a number. Reduce the month to a number. Reduce the year to a number.
Add the 3 together. This gives you a number.
Reduce this number to a number.
e.g. today's number date 30 / 03 / 2007
Day is 30
Month is 3
Year = 9
Sum of these is 15 which reduces to 6.
3+0+0+3+2+0+0+7=15
1+5=6
Basically 9 is the highest number. The number 13 would be 1+3=4 and so on. The idea is to return a single number between 1-9.
View 14 Replies
View Related
Feb 8, 2010
I was playing aroung some VBA code, but the code executes 98 times and I don't know why. For example, range A1 contains 5. When I type, say 3, in A1, I want A1 to show me 8 (5+3). Then I may type 10, in this case A1 must show 18 (8+10). And so on. I decided to place entered values in different column, then sum them in A1 with below stated code
View 3 Replies
View Related
Dec 18, 2008
I have several similar statements in different events in my UserForm code. Is it possible to separate these statements in a procedure and call it each it when I need it? The similar statements are:
With Sheets("Knowledge")
For Each rw In .Range("A2:A" & .Range("A" & Rows.Count).End(xlUp).Row)
If ListBox5.List(, 4) = Trim(rw.Value) Then
Label1.Caption = rw.Offset(, 1).Value
Label2.Caption = rw.Offset(, 4).Value
Label3.Caption = rw.Offset(, 5).Value
Exit For
End If
Next rw
End With
If it's not possible to make my code shorter with a procedure, can I optimize somehow this repeated code?
View 9 Replies
View Related
May 9, 2006
I have figured out how to assign a letter grade to a number, but am having trouble assigning it the other way, a number to a letter grade. For instance: If a student gets an A, I want the column next to it to indicate that the A represents a 4; a B represents a 3; a C represents a 2; D a 1; and F a 0. This will allow an easy grade point average calculation.
A 4 History
C 2 Math
A 4 English
B 3 Physical Ed
D 1 Science
GPA 2.80
View 3 Replies
View Related
Jun 11, 2014
I need a VBA code to create a Text file which should be in the form of DML (my scenario is to get Insert Statements for the Data available in the Excel) from Excel Sheet. And this has to be done by assigning a macro to command button where by clicking on it the DML text file should be generated. Even the syntax for the scenario will do.
View 1 Replies
View Related
May 21, 2014
Im trying to pull together a formula to achieve the below. What i have is a spreadsheet to be used by staff in different countries so im looking to make it easy to modify the categories used without the user needing to do anything complex with formulas.
The right hand side of my file (C:E) shows a code for each year we have covered a country with the year as a prefix (2014 - Blah). The left (A:B) is a summary showing the latest year we covered that country.
Current formula:
{=IF(COUNTA(C2:D2)<=0,"","✔-"&MAX(LEFT(C2:D2&"0",4)*1))}
The current formula works fine if you set the columns to where the data actually is but for ease of use i need it to look at the data in rows 1:2 and match up the Continent/Country and then MAX the dates.
View 1 Replies
View Related
Jul 29, 2014
1) What's the maximum limit of IF statements in a formula for MS Excel 2010?
2) I have 8 nested IF statements, but I am having trouble with the False part of the argument. I was able to get the False part to work for the 4th argument (because I simply put a comma and closed it's respective colored parenthesis) but the following 3 I can't seem to get and the following message pops when I hit enter "The formula you typed contains an error."
For the False part of the remaining 3 nested statement which is at the end of the formula I just type:
IF($E$2="Q3"........)))IF($E$2="Q2".....)))IF($E$2="Q1")))
And close it's respective colored IF statement argument. I tried putting a comma at the end of each False part for the arguments but it pops with the message "You've entered too many arguments for this function."
View 9 Replies
View Related
Jan 17, 2014
Supposing I have a list where each data set appears multiple times. How do I by formula make a list of the unique values?
I've uploaded to show what I mean.
View 11 Replies
View Related
Sep 19, 2012
I have a spreadsheet which is currently about 10 MB, I would like to reduce this as much as possible.
I am using lots of Vlookups but on each I am only referencing the data I need, there are also quite a few macros.
I paste value all the formula I do not need.
View 5 Replies
View Related
Jul 3, 2006
I don;t know if there is a way around this but we have a Excel workbook that holds around 14 worksheets taht is getting too large. It currently is around 2.5mb and we constantly use it as a template which is completed and emailed. Sometimes we have to email 4 of these all together and so teh email is too large, even zipping them has next to no effect on the size. The sheet that seems to causing the problem is one that has around 500 lines of formula across 20 columns. Most of these fields have conditional formatting and its this taht is boosting the size.
View 6 Replies
View Related
Nov 22, 2008
I have three IF statements as below. the problem is if the first statement is true I want it to skip the next two statements or the result will be changed again.
View 2 Replies
View Related
May 26, 2008
Sheet one will contain the following:
DATE A B C D E
2/22/2008TRUEFALSEFALSEFALSERon
2/23/2008FALSETRUETRUETRUEPhill
2/24/2008FALSETRUEFALSEFALSETracy
2/25/2008FALSEFALSEFALSEFALSESharon
2/26/2008TRUETRUEFALSETRUEBill
On sheet two I need to list any date that has three or more true statements with the coresponding name.
EXAMPLE:
2/23/2008Phill
2/26/2008 Bill
View 4 Replies
View Related
Jan 8, 2012
i want o make some command buttons on a sheet with the width 50 and when you move the mouse over to any one the width of that one should increase to 300. when you move he mouse over to the other one the size of the previous one should return to 50 and the new one (now under the mouse) should be 300.
i have written the code for it how ever it tends to increase the width twice i.e. it will increase the size of the command button, then reduce it to 50 and increase it again. this action makes it look like it flickering
Code below
Code:
Option Explicit
Dim sShapes As Shape
Dim ActShapes As Shape
Dim wsStart As Worksheet, WsNew As Worksheet
Dim wd
Dim mybutton
Dim ShapeChk As Boolean
[Code]....
View 2 Replies
View Related
Jan 16, 2008
I have a piece data acquisition hardware which stores data every 5 minutes into an excel sheet, I need to reduce the resolution of the data to every 30 minutes, currently I am doing this by deleting five rows leaving one and repeating the process, there is however 9285 rows
I am assuming there is a macro which can do this far quicker than me.
View 9 Replies
View Related
Dec 5, 2011
Here's my problem.
Charter default premium is a calculated as a rate on outstanding charter hire.
Therefore if charter period is 1 year and daily hire is 20,000, outstanding charter hire (policy limit) at inception would be 20,000 x 365 = $7,300,000
However, by day 365 outstanding charter hire and prevailing policy limit would only be 20,000 x 1 day = $20,000
The premium is calculated on a daily pro rata basis on the reducing outstanding amounts.
I've calculated the premium on the attached spreadsheet assuming hire is monthly not daily, but it would be too laborious to try and calculate that for 12 months or more on a daily basis. What I'm hoping is that there's a formula, covering the range of data, presumably using the calculation on the first day and the last day, but which cuts out all the intermediate steps.
View 3 Replies
View Related
Sep 17, 2012
I have an issue with a combo box and radio button.
Anytime I click on either of them, they reduce in size.
It's as if it is reducing by the same ratio every time until you can't click on it anymore.
View 3 Replies
View Related
Nov 13, 2006
I can't figure out a solution.
4 columns, thousands of rows.
Column A has alphanumeric data that can appear, once, twice, 3 times or 4, but never more than 4.
I want to see this spreadsheet so that each piece of data in column A is presented only once.
The information in the other 3 columns isn't important for what I want to do, so I need to reduce 20000 + rows, which includes many duplicates in Column A to about 5-60000, but need help figuring the correct formula/macro ....
View 9 Replies
View Related
Jul 25, 2006
I have columns of geological data in number form which may have about 4 or 5 decimal points. I want to reduce them to 2 decimal points without rounding the numbers up. Is there a simple way to do this?
View 4 Replies
View Related
Dec 20, 2012
i am trying to get back to the original purchase date of an asset.
It has being depreciating using the reducing balance method.
I have the Net book value of the asset currently, the original cost and the depreciation rate.
However i do not know the quickest way in excel to work back to the original purchase date.
See attached file for examples and my long workaround to estimate purchase date.
View 1 Replies
View Related
Aug 17, 2011
Is it possible to do a drop down list that allow user to select pre-defined selections but everytime when a selection is chosen, the list reduced?
Example,
I have can choose Apple, Orange, Durian and Mango.
The drop down can only select these 4 fruits.
So there are 4 cells in Column A1, A2, A3, A4.
A1 selects Mango and then A2 will only have 3 options to choose. So until the last cell, he can only choose the last fruit left.
A1, A2, A3, A4 are not selecting in descending order thus it could be A3 selecting first, then A2 and then A4.
I'm using excel 2007
View 13 Replies
View Related
Oct 14, 2009
How can I combine the two below statements like these to make one "Or Statement"? Sorry...I haven't done excel and/or's in forever?
=IF(('Proj Info'!L10="main")*AND('Proj Info'!L9="CT"),"BMSVC",'Proj Info'!L9)
OR
=IF(('Proj Info'!L10="serv")*AND('Proj Info'!L9="CT"),"BMSVC",'Proj Info'!L9)
View 2 Replies
View Related
Dec 21, 2012
I have letter and number combination code in two collumns and they differ for 10.000 numbers:
BAM98314
BAM88314
BAM90000
BAM80000
As you can see the left code is for 10000 numbers higher. the letters are allways the same. In the event that this isn't so, if difference between codes in same row is more or less than 10000 numbers. I was thinking on making conditional formating so the cells with wrong difference would be marked red, but I do not know how to make formula for this difference.
View 2 Replies
View Related
Nov 23, 2009
is it possible to have boxes for numbers to be inserted into
i want the user to be able to fill in bank account and sort codes numers into the relevant individual box for each number
View 9 Replies
View Related
Aug 10, 2009
I'm using this formula to pick all rows from a huge range of cells "DATA" in another sheet, by matching the first column value (SAPDATA is the range that contains all the first column cells of DATA).
{=IF(ROW($B49)-ROW($B$48)>COUNTIF(SAPDATA,$D$4),"",INDEX(DATA,SMALL(IF(SAPDATA=$D$4,ROW(SAPDATA)),ROW($B49)-ROW($B$48)),2))}
All possible first column values have been stored as a dropdown in cell D4, and whenever I change the choice in the dropdown cell, the retrieval of those hundreds of rows takes ages in excel.
View 9 Replies
View Related
Jun 25, 2014
I am attempting to build a mileage tracker based on a master list of code numbers. After submitting the date in cell A, in the next cell, B, I would type a code number from the list, say 7. Seven is the massage parlor that is 15 miles away. So 15 would come up in the next cell C.
View 3 Replies
View Related
Apr 18, 2007
For example, Column D, Rows 2 - 500 contain different number codes:451
461
593
675
I want to match up the number code and replace it with the Course Name.451 = Course A
461 = Course B
593=Course C
675=Course D
I am looking to have the number code, i.e., 451 replaced in Column D with the Course Name, Course A or the Course Name appear in Column E pulling from the number code.
In the end I will probably have 100 unique number codes to match up with course names.
View 9 Replies
View Related
Aug 4, 2012
i am using the code
activesheet.usedrange.columns.count
to get to know the no of columns used in the data set in a worksheet. bt the problem is it is count the unnessary columns which are not part of the dataset too.
View 9 Replies
View Related
Jun 10, 2009
i need code that can look at cell d23 and take that number( say it is 13) and break it down into groups. that have 3, 4 or 5 per group. in this example 13 can be broken down into
View 3 Replies
View Related
Jul 15, 2009
I would like to add something (formula) to the following code to automatically add a new ID number with each new entry. Some of the entries will have the same name but each time a new entry is added I want the ID number to increase by 1. Assume that the first entry is 0001.
View 5 Replies
View Related