formula

how to write results of a formula directly into an excel range by VBA code

不羁的心 提交于 2019-12-11 16:02:22
问题 I have a series of functions for each of listobject columns. The file is heavy and crashing, so I want just to keep the results of each formula as static values. I can allocate formula to the range and ask excel to convert the range to value. But I am wondering if there is a way to ask VBA to write only the static values in the range instead of the formula itself. Here is what I have so far: Sub calculate2() Dim i As Long, t As Long t = Timer With Sheet3.ListObjects(1) For i = 3 To 9

Double linear sequence gives odd results

柔情痞子 提交于 2019-12-11 13:39:31
问题 I'm trying to get my performance skills (none existent) up to par but ran into a problem with writing out a formula into code. This is the formula I'm trying to - quote unquote - "convert" to code. Consider a sequence u where u is defined as follows: The number u(0) = 1 is the first one in u . For each x in u , then y = 2 * x + 1 and z = 3 * x + 1 must be in u too. There are no other numbers in u . Ex: u = [1, 3, 4, 7, 9, 10, 13, 15, 19, 21, 22, 27, ...] 1 gives 3 and 4 , then 3 gives 7 and

Excel cell displaying zero instead of a calculated / referenced value

你。 提交于 2019-12-11 13:33:02
问题 I am exporting an Excel file with Apache POI using an Excel file as source and for some cells (not all) simply referencing others (like ='worksheet2'.B13 ) or calculating a value with referenced cells (like ='worksheet2'.C13 + 'worksheet2'.D13 ), they only display zero (0) instead of the right value. Weird thing is that when I click on the formula and change something in it, as typing a space and deleting it and then I type enter, the right value is displayed ! For info, the type of those

Find count of items in column and add the values from another column

你。 提交于 2019-12-11 13:09:42
问题 I have two columns in a table (A and B). Column A has an item name and Column B has a quantity. I want to sum the quantities for all the items that have the same name. Example: Item | Quantity ------------+---------- Red Hat | 3 Green Shirt | 9 Red Hat | 4 Blue Pants | 6 Blue Pants | 3 Green Shirt | 12 and I would like to add a column to the table that has this: Item | Quantity | Total ------------+------------+------- Red Hat | 3 | 7 Green Shirt | 9 | 21 Red Hat | 4 | 7 Blue Pants | 6 | 9

Calculating a new column using two other columns by considering time decaying factor

女生的网名这么多〃 提交于 2019-12-11 12:45:20
问题 My question is a little tricky and I would appreciate if anyone help me. I have the following table which I want to calculate the last column (intellectual capital prior to current competition) based on the scores users received in the previous competitions. the scores decays over time by the following formula: score*e^(-t/500) t is the number of days that have passed from the prior competition. if the user have participated in more than one competition prior to the current one we add the

Nested IFs to pad numbers with zeroes [duplicate]

不羁岁月 提交于 2019-12-11 09:37:28
问题 This question already has answers here : Add leading zeroes/0's to existing Excel values to certain length (7 answers) Closed 4 years ago . I am looking to pad a columns with zero's so that I can later concatenate it's value. It needs to 4 characters, so I am trying to use a Nested If Statement. =IF(LEN(G2)=3,"0" & G2),IF(LEN(G2)=2,"00" & G2,G2) I only get '#Value'. Where am I going wrong? 回答1: Don't reinvent the wheel: there is already a built-in function do to this. =TEXT(G2,"0000") Now, to

C++ Chudnovsky Formula for Pi

断了今生、忘了曾经 提交于 2019-12-11 09:35:25
问题 I am trying to make a C++ application calculate pi for me. I have tried to implement the Chudnovsky formula with no luck. Here is my code: #include <iostream> #include <cmath> long fac(long num) { if (num == 1) return 1; return fac(num - 1) * num; } int main() { using namespace std; double pi; for (long k = 0; k < 10; k++) { pi += (pow(-1, k) * fac(6 * k) * (13591409 + (545140134 * k))) / (fac(3 * k) * pow(fac(k), 3) * pow(640320, 3 * k + 3/2)); } pi *= 12; cout << 1 / pi << endl; system(

Google Fusion Table Formula

心不动则不痛 提交于 2019-12-11 07:43:47
问题 I have a Google Fusion table and I am trying to add a formula column with a simple if statement. The column TYPE contains numbers 1-5. I want to update a formula column based on the value in the TYPE column. I tried many variations (single quote, double quote, etc) of the following: IF(TYPE=1,'red','yellow') But, it always says invalid formula. If statements are permitted and I am following the format described here: https://support.google.com/fusiontables/answer/178196?hl=en What am I

How to save CSE Excel formula in plain CSV format?

爱⌒轻易说出口 提交于 2019-12-11 07:26:10
问题 I would like to form CSV excel file in my program. Some cells contains CSE (Ctrl+Shift+Enter) formulas (array formulas). This does not work: =SUM(IF(COUNTIF(B4:B1000;B4:B1000)=0; ""; 1/COUNTIF(B4:B1000;B4:B1000))) This does not work too: {=SUM(IF(COUNTIF(B4:B1000;B4:B1000)=0; ""; 1/COUNTIF(B4:B1000;B4:B1000)))} This formula makes distinct count on cells array... 回答1: Try converting your array formulas to normal formulas by using instead: =SUMPRODUCT((B4:B1000<>"")/COUNTIF(B4:B1000;B4:B1000&""

How to match a data frame of variable names and another with data for a regression?

与世无争的帅哥 提交于 2019-12-11 07:05:10
问题 I have two data frames: x = data.frame(Var1= c("A", "B", "C", "D","E"),Var2=c("F","G","H","I","J"), Value= c(11, 12, 13, 14,18)) y = data.frame(A= c(11, 12, 13, 14,18), B= c(15, 16, 17, 14,18),C= c(17, 22, 23, 24,18), D= c(11, 12, 13, 34,18),E= c(11, 5, 13, 55,18), F= c(8, 12, 13, 14,18),G= c(7, 5, 13, 14,18), H= c(8, 12, 13, 14,18), I= c(9, 5, 13, 14,18), J= c(11, 12, 13, 14,18)) Var3 <- rep("time", each=length(x$Var1)) x=cbind(x,Var3) time=seq(1:length(y[,1])) y=cbind(y,time) > x Var1 Var2