i have this function that poulates data from a userform into a sheet.
For lLoop = 1 To MAWBNoVar
With Range("B" & Rows.Count).End(xlUp)
.Offset(1, 0) = Controls("txtMAWB" & lLoop)
.Offset(1, 1) = Left(Controls("cbDestination" & lLoop), 3)
.Offset(1, 2) = Controls("txtGW" & lLoop)
.Offset(1, 3) = Controls("txtCBM" & lLoop)
.Offset(1, 4) = "= ROUND(E" & Y & "*167,0)"
.Offset(1, 5) = "=IF(D" & Y & ">F" & Y & ",D" & Y & ",F" & Y & ")"
.Offset(1, 6) = "=IF(F" & Y & ">D" & Y & ",G" & Y & "-D" & Y & ",G" & Y & "-F" & Y & ")"
Y = Y + 1
End With
Next lLoop
My problem is that the data being entered into the sheet for the lines highlighted in red is going in as text, and not true numerics, so that the subsequent formulae are not working correctly.
I have a Userform where i have the user in put a dollar amount in a text box. Im having difficulty getting this assigned to a variable as an integer. I get a "type mismatch" error. I have tried declaring the variable as an integer, and tried the cint() function, but i get the same error.
I have a problem that when I try to convert text to number and format the number without 2 decimal places as seen on the link I have given below, Instead of 1607.947, I get 1607947. I have Excel 2010 loaded. The details are in below picture.
I have a column that says either TRUE or FALSE this is dependent on what number i input into another cell, so if i input 8, TRUE shows on every 8th row,
I want the cells that say TRUE to also have a sequential number next to it in the column beside it.
Formula i have: =MOD(ROW(S2)-1,nth_No.)=0
So for example, every 3rd row is TRUE, i am wanting a sequential number beside it:
I have an Excel workbook which has 10 rows of numbers with a min of 20 and max of 30. The random number lies in column B and this will be tested to see if it lies between the min and max. I need to loop this 10 time over
I first started out declaring the 3 variables and assigning values to each variable. It works if I assign a value of 22 for Number but I want VBA to see the Number and make a decision (True or False) if that number lies within the range of 20 to 30.
Should I name the Number variable as a variable because its value will change depending on if it matches the conditions? Also would a case be easier? Between.xlsx
I've tried using the worksheetfunction.sumif route and couldn't seem to get the syntax correct. I'd prefer the worksheetfunction route, as I don't need the formula stored, but it would be great to have both of these pieces of code for reference online - I scoured Google, and the examples I found were pretty weak.
I've recorded the macro (hence the R1C1 references in the second example) and had it work perfectly, but when I replaced row references with my variables, it went back to displaying "TRUE." I'm including all the code here.
Variables: expr = 3 to 38 (For loop) startrow = the starting row for the reference data endrow = the ending row for the reference data thresh = minimum threshold (a number)
I'm trying to count the number of occurrences where two conditions in a table are true.
I have a table that has two columns for ratings; impact and probability. Each can be scored 1-5 This creates a matrix table of possible scores from 1 - 25 (image attached)
I want to COUNT the number of items in each of the boxes (not the total score). For example, how many are Impact 5 and Probability 5 (25 total); how many are Impact 4 and Probability 2 (8 total), and so on. Basically a count of the each of the intersections in the matrix.
Something like "Countif Impact is 5 AND Probability is 5"
Is it possible to count something once, checking for multiple conditions?
I am using a spreadsheet to determine if students are meeting Growth Targets between a pre test and post test.
Here is my formula
=If(D8>=C8,"yes","no")
D8 is the Growth Target and C8 is the Post test Score.
After doing this, I need to calculate the percentage of Yes results. This year it will be easy, as it only applies to 25 students. Count the yes's and multiply by 4. Next year, it will apply to number in the neighborhood of 150 students.
I have a list of items that I am preparing to upload to an access database. The list is quite lengthy and has required a lot of manual corrections to get it prepared for upload. It also has several columns that are not needed in the access database, but that I used to make sure that all of my data was ready. What I'd like to do is create a new table that will have the same structure as the table in my access database and upload the portion of data that I have ready now so that I can do some further development using actual data. In order to do this I need to extract the ID Numbers (column B values) of the records that are marked "True" in the "Ready" column (column G Values) and deposit them in the new table. I only want to copy over the ID Numbers as the additional fields will be populated with match / index lookups from a third table that I have on another worksheet.
I have two columns with values. Then I have a third column with one letter A or B.
I'm not used to excel, but I've tried my way with COUNTIFS and I'm pretty sure it's the way to go, but I'm lost in the syntax.
I want to count the number of times the values in the first column is larger than the values in the second column, if the letter is A. And then flip the ">" sign and count that and hopefully the first number is higher.
I have two data columns: the first is a list of the last 100 calendar dates, and the second is an ON/OFF (or 1/0 if you prefer) value corresponding to each date. If the last value in the second column list is ON, I want to find how many continuous days the value has been ON for. If the last value in the second column is OFF, I want it to return a zero. Note that in the 100 day span of data, the value may switch between ON and OFF several times, but I only want the continuous, uninterrupted ON days at the end of the date range.
I'm trying to make a formula but are failing. This is the data:
Cells: a1= ant-gel a2= ant - gel a3 = size 1 - 6 a4 = size 1-6 a5 = book - 5 a6 = book-5 a7 = good book
I want a formula that displays "True" if cell contains a "-" symbol AND the dash symbol is surround on both sides by a number (a space can go between dash and number)
I want the results to go in column B
For example, if a1 contains a dash and dashes are surrounded on both sides by a number, then "TRUE", otherwise "FALSE.
I have a userform that contains textbox's that are linked to excel cells and i was wondering if there is a way to format the textbox to show the values in the number format. As the cells values are constantly changing the following code only works if the number is in the hundred of billions but if the number changed to 10,000 for example the format would not adapt.
Private Sub TextBox1_Change() Me.TextBox5 = Format$(CStr(ThisWorkbook.Sheets("ISN").Range("H1").Value) * Val(TextBox1.Text), "###,###,###,###") End Sub
I have a number in a cell (12.34) I wish to copy this number into a user form textbox. I can copy the number, however it is about 6 places behind the decimal point. How can I round the number going into a textbox to 2 places?
I am trying to manipulate a stock list using a Userform to simplify the UI.
Problem:
The idea is to allow the user to enter data via the Userform which works fine until we need to do calculations. The spreadsheet contains calculations which use the cost and margin data input via the Userform. The formula results are then supposed to display via the Userform. The problem is that the spreadsheet calculation is overwritten when the save/update button on the Userform is clicked. I understand why this is happening, but I am unable to fix it.
I'm just trying to get a total of columns E, F and G, and place those totals in row 5. The problem is that somehow the numbers in column G were stored as text, so the SUM formula is coming up "0". How would I format these cells, in a macro, (columns E, F and G, just in case the data in the other two columns were stored as text), as a number so that I can total them.
I've tried selecting the column, selecting format cells and choosing number, but that doesn't work. I can manually select the cells, click the little exclamation point, and then tell it to convert to number. This works, but when I tried to record it to add it to the macro, it didn't record anything but the selection of the cells.
I have a string of imported data which comes into an existing spreadsheet. It cannot be changed prior to importing as the data is provided by an external vendor.
When the data is imported into my spreadsheet the Error Checking tag comes on, after I select the cells where certain numeric data has been entered, stating that this is a range of Numbers Stored as Text. If I click on the Error Checking tag and select the Convert to Number option and then enter my VLOOKUP function I get the desired answer. If I do not convert the text to numbers then my VLOOKUP function does not work at all. The cell just displays the function text itself instead of the desired answer.
Here is what I am requesting:
Assistance with writing the VBA code to accomplish the manual task of converting the text to numbers. I have tried to format using the Ribbon without success.
when i import some data from web some of the character show ¾ or 1½ ..these look like a word rather than number so may i know how can i convert "1½" to 1.5?
I want to automatically prevent users from entering more than two digits into a textbox.
i dont want to show a message box or anything like that. I want it to be physically imposible for them to enter more than two digits i.e. when they enter two digits, pressing any other keys on the keyboard should have no effect on the contents of the textbox.
This code works fine, the problem is if I put a number in, and then backspace in the textbox to change the number, I get a runtime 13, type mismatch. This error only occurs when I delete all the numbers in the cell. For example, say the number in the cell is 5025. If i change it to 5123, that is I did not have to delete the first 5, it will work. If I want to change to something like 4167, i must delete the first 5 and it will give the error. I have only been using VBA for a couple weeks, I assume it's something simple.
Private Sub TextBox1_Change() Dim StaffCost As Single Dim AvgDriveTime As Single Dim AddlDrives As Single StaffCost = OLEObjects("TextBox1").Object.Value AvgDriveTime = Range("E5").Value AddlDrives = Range("F5").Value With Range("G5") .Font.Bold = False .Value = StaffCost * AvgDriveTime * AddlDrives End With End Sub
I have a combobox embedded into an excel sheet with a linked cell and a range defined in the combobox properties. Every time I change the value in the combobox, the value in the linked cell is stored as text instead of a number.
I have tried copying a cell containing 1 and copying and pasting as special into the linked cell but that only fixes it for the time being. If I change the value in the combobox again, the value in the linked cell is again stored as text. I tried =value() in the linked cell but that again only worked temporarily. Every time I change the value in the combobox, the value in the linked cell is stored as text.
I am trying to convert the name of a month to a number but there is a slight issue with using my normal method of TEXT("1/"&A1&"/2013","mmm")
I am trying to create a dynamic table which if you change 1 value for the month, it changes others
so my data looks like so,
Jan Feb Mar Apr May <---- this is the value which is chosen
The problem is when I select the month "January", it assigns the value of the above cell as 1/0/2013 which is not a date when in fact I want to set it as "December".