我正在尝试按照以下方法填充摊销时间表。
我当前使用的公式是:
=IF($B2=$1:$1,$A2/$C2," ")
但是,这仅填充了第一个点(“起点”),我想做的是根据摊销期限对此进行补偿。理想的结果是:
使用公式是否可以-还是需要通过VBA尝试运气?
答案 0 :(得分:2)
输入以下公式:
D2:openssl rc4
E2:#include <fcntl.h>
#include <openssl/evp.h>
#include <openssl/rc4.h>
#include <stdio.h>
#include <stdlib.h>
#include <string.h>
#include <sys/stat.h>
#include <sys/types.h>
#include <unistd.h>
int main() {
int fd = open("ssloutput.txt", O_RDONLY);
if (fd < 0) {
perror("open ssloutput.txt");
return 1;
}
struct stat st;
if (fstat(fd, &st) < 0) {
perror("fstat");
return 1;
}
size_t size = st.st_size;
unsigned char *fileIn = calloc(size, 1);
if (!fileIn) {
perror("calloc");
return 1;
}
if (read(fd, fileIn, size) != (ssize_t)size) {
perror("read");
return 1;
}
close(fd);
unsigned char *fileOut = malloc(size);
if (!fileOut) {
perror("malloc");
return 1;
}
// Prepare the key according to the same rules as openssl rc4 -k foo
char keygen[] = "PASSword123";
RC4_KEY key;
unsigned char computed_key[16];
if (EVP_BytesToKey(EVP_rc4(), EVP_sha256(), NULL,
(const unsigned char *)keygen, strlen(keygen), 1,
computed_key, NULL) != 16) {
fputs("Error calculating rc4 key!\n", stderr);
return 1;
}
// Should match the one printed out by openssl rc4 -p
fputs("key=", stdout);
for (size_t n = 0; n < sizeof computed_key; n += 1) {
printf("%02hhx", computed_key[n]);
}
putchar('\n');
RC4_set_key(&key, sizeof computed_key, computed_key);
RC4(&key, size, fileIn, fileOut);
int fd2 = open("rc4output.txt", O_WRONLY | O_TRUNC | O_CREAT, 0644);
if (fd2 < 0) {
perror("open rc4output.txt");
return 1;
}
if (write(fd2, fileOut, size) != (ssize_t)size) {
perror("write");
return 1;
}
close(fd2);
free(fileIn);
free(fileOut);
return 0;
}
D2仅在D列中填充。
E2会在所有其余列中填充,然后向下填充。