连续查找一个单元格并复制值

时间:2018-07-24 16:51:38

标签: excel excel-formula match

我想在行D4中找到一个值时,即在B列中找到“ 3”(在B"X"中), D5B"X+1"必须是D6的值,B"X+2"必须等于from matplotlib import pyplot as plt from sklearn.gaussian_process import GaussianProcessRegressor from sklearn.base import BaseEstimator from sklearn.gaussian_process.kernels import RBF, Matern, WhiteKernel, ConstantKernel, RationalQuadratic, ExpSineSquared, DotProduct # define Kernel import numpy as np kernels = [1.0 * RBF(length_scale=1.0, length_scale_bounds=(1e-1, 10.0)), 1.0 * Matern(length_scale=1.0, length_scale_bounds=(1e-1, 10.0), nu=1.5), 1.0 * RationalQuadratic(length_scale=1.0, alpha=0.1), 1.0 * ExpSineSquared(length_scale=1.0, periodicity=3.0, length_scale_bounds=(0.1, 10.0), periodicity_bounds=(1.0, 10.0)), ConstantKernel(0.1, (0.01, 10.0)) * (DotProduct(sigma_0=1.0, sigma_0_bounds=(0.0, 10.0)) ** 2), ] # Define inputs and outputs x = np.array([-5.2,-3,-2,-1,1,5], ndmin=2).T X = x.reshape(-1, 1) y =np.array([-2,0,1,2,-1,1]) max_x = max(x) min_x = min (x) max_y = max (y) min_y = min(y) for fig_index, kernel in enumerate(kernels): # call GP regression library and fit inputs to output gp = gaussian_process.GaussianProcessRegressor(kernel=kernel) gp.fit(X, y) # parameter = get_params(deep=True) # print(parameter) gp.kernel_ print(gp.kernel_) plt.figure(fig_index, figsize=(10,6)) plt.subplot(2,1,1) x_pred = np.array(np.linspace(-5, 5,50), ndmin=2).T # Mark the observations plt.plot(X, y, 'ro', label='observations') X_test = np.array(np.linspace(max_x+1, min_x-1, 1000),ndmin=2).T y_mean, y_std = gp.predict(X_test, return_std=True) # Draw a mean function and 95% confidence interval plt.plot(X_test, y_mean, 'b-', label='mean function') upper_bound = y_mean +y_std lower_bound = y_mean - y_std plt.fill_between(X_test.ravel(), lower_bound, upper_bound, color = 'k', alpha = 0.2, label='95% confidence interval') # plot posterior y_sample = gp.sample_y(X_test,4) plt.plot(X_test,y_sample,lw=1) plt.scatter(X[:,0],y,c='r',s=50,zorder=10,edgecolor=(0,0,0)) plt.title("Posterior (kernel:%s)\n Log-Likelihood: %3f" % (gp.kernel_, gp.log_marginal_likelihood(gp.kernel_.theta)), fontsize=14) plt.tight_layout() plt.show() ,依此类推。优选地,该解决方案必须是公式,而不是VBA。

感谢您的帮助

1 个答案:

答案 0 :(得分:2)

使用:

=INDEX(B:B,MATCH($D$4,B:B,0)+ROW(1:1))

将其放在D5中并复制下来。

enter image description here