所以我对使用excel非常陌生,我可能错过了这样一个已经回答的问题,但我想要做的是测量一组点之间的距离。大型excel表。
我已经尝试过编写函数的标准方法并将其向下拖动但是当我向下移动函数时函数的变化方式并不是我需要的,而且我似乎无法想象我怎么样解决这个问题,所以我认为宏可能就是解决方案。
数据是8个测量组,每组有一个蓝色,红色,黄色,Csome,重叠,绿色,青色和完整对象。每个对象的XYZ坐标列在前三列中,并使用简单的距离公式,我试图测量每个对象与其相同组中的所有其他对象之间的距离。例如。蓝色到红色,黄色,Csome ......等等再次为Blue2到Red2,Yellow2,Csome2 ......和Blue3到Red3,Yellow3,Csome3 ......等等。
然而,当我将下面的公式放在我想要的输出应该是的地方并尝试将其拖下来时,显然我遇到了一些问题。对于第一个蓝色反对它的整个组,我开始= SQRT((A $ 2-A2)^ 2 +(B $ 2-B2)^ 2 +(B $ 2-B2)^ 2)并将其拖下来所以它循环通过第2行与第3,4,5,6,7,8和9行。当我到第10行包含Blue2时出现问题。这不应该与Blue1进行比较,而应该开始一个新的组。然后我怎样才能让循环在第10行重新启动,以便在该组中比较以蓝色2开头的新组,例如第10行中的XYZ到11,12,13中的XYZ ...... :
Position X Position Y Position Z Unit Category Collection Surpass Object
16.38 41.20 4436.18 um Surface Position Blue Selection
17.35 40.83 4436.17 um Surface Position Red Selection
15.93 40.62 4435.93 um Surface Position Yellow Selection
16.22 40.80 4436.03 um Surface Position Csome1
17.97 42.23 4435.46 um Surface Position Overlap
15.37 40.87 4436.03 um Surface Position Green Selection
15.44 40.04 4436.39 um Surface Position Cyan Selection
17.97 42.23 4435.46 um Surface Position Full 1
15.57 36.20 4435.75 um Surface Position Blue Selection 2
12.83 35.19 4435.33 um Surface Position Red Selection 2
15.76 37.25 4435.74 um Surface Position Yellow Selection 2
14.94 36.17 4435.65 um Surface Position Csome2
15.99 36.78 4436.34 um Surface Position Overlap 2
14.23 36.26 4435.57 um Surface Position Green Selection 2
13.61 36.96 4436.09 um Surface Position Cyan Selection 2
14.64 36.42 4435.80 um Surface Position Full 2
42.83 36.04 4435.47 um Surface Position Blue Selection 3
42.34 36.56 4435.63 um Surface Position Red Selection 3
42.25 36.87 4435.75 um Surface Position Yellow Selection 3
42.48 36.50 4435.62 um Surface Position Csome3
41.77 36.02 4435.67 um Surface Position Overlap 3
42.64 36.89 4435.73 um Surface Position Green 3
42.05 36.90 4436.21 um Surface Position Cyan Selection 3
42.34 36.53 4435.71 um Surface Position Full 3
33.75 33.13 4436.32 um Surface Position Blue Selection 4
34.99 33.12 4436.38 um Surface Position Red Selection 4
35.40 31.97 4436.38 um Surface Position Yellow Selection 4
34.75 32.58 4436.36 um Surface Position Csome4
39.03 35.24 4436.04 um Surface Position Overlap Selection 4
35.49 32.19 4436.49 um Surface Position Green Selection 4
36.14 32.35 4436.42 um Surface Position Cyan Selection 4
36.16 33.20 4436.30 um Surface Position Full 4
答案 0 :(得分:3)
Applying some VBA to loop through the matches to Full with a wildcard and reset the formula's starting row for each iteration should be the best way to go with this.
<script type="text/javascript">
document.addEventListener('click', function(e) {
var tre = e.target.href || '';
if( tre.indexOf("link.php") > -1) {
[SOMETHING HERE THAT USES THEIR CODE]
}
}, false);
</script>
The results should resemble the following.
答案 1 :(得分:2)
Well as a new excel user you've jumped straight into the wonderful and perplexing world of array formula's.
First you need to prep your data a bit. All those 1s, 2s, 3s and 4s need to be in a column of their own, all those in group 1 need a number, and everything needs to be named consistently ('Green' vs 'Green Selection'). We could make the formula even more complex to account for these idiosyncracies in your data, but cleaning it will make understanding it and the formulas easier.
Now we put the "Surpass Object" we want to calculate the distance from in Cell @Table(name = "FIELD_CRITERIA")
public class FieldCriteriaEntity implements Identifiable{
@Id
@GeneratedValue(strategy = GenerationType.AUTO)
@Column(name = "CRITERIA_KEY", unique = true, nullable = false)
private Long id;
@OneToOne(fetch = FetchType.EAGER, cascade = CascadeType.ALL,optional=true)
@JoinColumn(name="CRITERIA_ID")
private StringCriteriaEntity stringCriteria;
@OneToOne(fetch = FetchType.EAGER, cascade = CascadeType.ALL,optional=true)
@JoinColumn(name="CRITERIA_ID")
private NumeriCriteriaEntity numericCriteria;
@OneToOne(fetch = FetchType.EAGER, cascade = CascadeType.ALL,optional=true)
@JoinColumn(name="CRITERIA_ID")
private DateCriteriaEntity dateCriteria;
}
(in this case 'Blue Selection') and the following formula into cell I1
being sure to hold I2
when we enter it.
ctrl+shift+enter
This will get us the distance between the x and y co-ordinates for each. You'll need to adjust the formula to add the z-coordinate to the calculation if you need it.
So what is the fancy index-match formula doing? In the first instance it grabs the cell in column a, that matches both the 'Surpass Object' in the column header (cell =SQRT((INDEX($A$2:$A$33,MATCH(1,($G$2:$G$33=I$1)*($H$2:$H$33=$H2),0))-$A2)^2+(INDEX($B$2:$B$33,MATCH(1,($G$2:$G$33=I$1)*($H$2:$H$33=$H2),0))-$B2)^2)
) and the group of the current row (cell J$1
)
Now you can just fill in the remaining headers and fill the formula right and down to get your matrices of differences
答案 2 :(得分:2)
You need to handle the .model small
.stack 0100h
.data
a db 0ah, 0dh,"ENTER FIRSTNAME: $"
b db 0ah, 0dh,"ENTER SECONDNAME: $"
c db 20d, ?, 20d DUP("$")
d db 20d, ?, 20d DUP("$")
.code
main proc
mov ax, @data
mov ds, ax
mov es, ax
call cls
call input
call output
mov ax, 4c00h
int 21h
main endp
;clear screen
cls proc
mov ax, 0600h
mov bh, 07h
mov cx, 0000h
mov dx, 184fh
int 10h
cls endp
;INPUT
input proc
mov ah, 09h
mov dx, OFFSET a
int 21h
mov ah, 0ah
mov dx, OFFSET c
int 21h
mov ah, 09h
mov dx, OFFSET b
int 21h
mov ah, 0ah
mov dx, OFFSET d
int 21h
input endp
;OUTPUT
output proc
mov ah, 09h
mov dx, OFFSET c+2
int 21h
mov ah, 02h
mov dl, 003h
int 21h
mov ah, 09h
mov dx, OFFSET d+2
int 21h
output endp
end main
, A$2
references with a function that will calculate the row. You can use reference functions like B$2
, INDEX
or INDIRECT
to accomplish what you need. The last two are volatile, so keep in mind they recalculate every time a value changes in your sheet. OFFSET
is more efficient.
It isn't clear if your data includes the group number because the numbers at the end of the row are inconsistent. If they are consistent in your data you can use them. Supposing the group number is in column INDEX
, This I
formula will return the correct INDEX
reference:
A$2
Or with the INDEX($A$2:$A$33,1+((I2-1)*8))
function:
OFFSET
Otherwise, (without using the group number) you can use the OFFSET($A$2,(I2-1)*8,0)
function to produce a similar result:
ROWS
The INDEX($A$2:$A$33,1+QUOTIENT(ROWS(A$2:A2)-1,8)*8)
in all the formulas represent the number of items in a group.
And the full formula would be:
8