问题
So I have a long list of raw data in Excel wherein I need a formula to get the values of specific rows and paste them into another column. This is how I want it to happen.
Picture of the Data in my Excel file:
I need the end result to be like this:
Is there any formula for this?
回答1:
Not exactly the answer to your question, but if you have at least 1 of your data sets to use as an input value, you can match()
your data into a table... a little bit closer to what I think you're asking.
You can achieve this with a combination of Match()
, Address()
, and Indirect
.
I input the red value (in the image, "headerB") and I can output the subsequent values in D15
with this formula:
=INDIRECT(ADDRESS(MATCH(C15,A1:A10)+1,1))
I match find the input value in column A using Match()
.
Then, I use that to get an address of a cell by offsetting +1
in the row
argument of Address()
. The output would be $A$7
in this case... i get the value of that address using Indirect()
, so you will see b1
.
For the other subvalues, you can change your offset within the row argument of Address()
to be +2
and +3
.
Edit:
Similar to the above, you could use some helper columns and get your data without needing to have a starting value:
=INDEX(A1,0) 'outputs headerA in the image example
You can drag that formula across as needed... or you can do something like:
This uses helper values in the formula:
=INDIRECT(ADDRESS(C$13+$G15,1))
Note that the 1, 6, 11, will allow you to select the range and "drag" down to get the offset since they're always the same spaced distance.
来源:https://stackoverflow.com/questions/59773606/getting-value-by-incrementing-to-a-specific-row-in-excel