Find data in various positions in a column and return the cell contents

JeffGrant

Well-known Member
Joined
Apr 7, 2021
Messages
519
Office Version
  1. 365
Platform
  1. Windows
Hi All,

I am a bit stuck. All assistance is very graciously received and very much appreciated.

Here is my scenario.

I past a column of data into a sheet. No Problem. In the attached sheets, that is Column A.
The first 2 cells in the pasted column data, never change the type of data or the location. So I can extract that easy enough into Column C.
The next 4 cells in the extracted data, Column C, do change the row and can be anywhere in rows 14 to 40. With 3 of the 4 cells, the data is extracted all from the same pasted cell. This is no problem, if I now the row number that it gets pasted to.

I would like to automate the extraction for cells C10, C11 & C13. I am happy to manually type the data for C12, because there are several different types of data here.

For example, some of the data in C12 could be: Mdn HCP, hcp, (c1), (BM60), (bm48+), Class 2, just to name a few. I think there too many variants in this one to automate for now.

I have looked at the Aggregate/Index and Rows functions and I just don't seem to be able to put it together and make it work.

I hope I have pasted the mini-sheet correctly.



Test.xlsx
ABCDEF
5Calculated ResultRequired Result
6Pasted DataMy Formula Attempt, using fixed cell locations
7Comment
8CanterburyTrackCanterburyCanterburyFixed Cell location
9Good (4)ConditionGood (4)Good(4)Fixed Cell location
10Distance (m)12001200Can be anywhere between rows 14 and 40
111Race Number11Can be anywhere between rows 14 and 40
12ClassMdn HCPCan be anywhere between rows 14 and 40
132Time12:45 PM12:45 PMCan be anywhere between rows 14 and 40
14
153
16
174
18
195
20
216
22
237
241200m R1 Vinery Stud Mdn Hcp
2512:45
26
27
28
29
Sheet1
Cell Formulas
RangeFormula
C8C8=INDEX(A8:A28,1,1)
C9C9=INDEX(A8:A28,2,1)
C10C10=VALUE(IF(FIND("m ",A24,1)=5,LEFT(A24,4),LEFT(A24,3)))
C11C11=VALUE(MID(A24,SEARCH("R",A24,1)+1,2))
C13C13=INDEX(A8:A34,18,1)
 

Excel Facts

VLOOKUP to Left?
Use =VLOOKUP(A2,CHOOSE({1,2},$Z$1:$Z$99,$Y$1:$Y$99),2,False) to lookup Y values to left of Z values.
There seems to be little confusion about what rows the column A data is in (description says 14:40 but formulas indicate 8:28) but see if these help.
BTW, if the first two values are always the first 2 cells in A8:A28 the formulas to get those can be simple that what you currently have.
You haven't told us how to identify the relevant row data (row 24 in your example) so I have assumed it will be the only row with more than a certain number of characters (15 I used)
I have also assumed that you have the LET function. If not, that formula can be modified.

21 05 04.xlsm
ABC
7
8CanterburyTrackCanterbury
9Good (4)ConditionGood (4)
10Distance (m)1200
111Race Number1
12Class
132Time12:45
14
153
16
174
18
195
20
216
22
237
241200m R1 Vinery Stud Mdn Hcp
2512:45
26
27
28
Extract
Cell Formulas
RangeFormula
C8:C9C8=A8
C10C10=LET(s,FILTER(A14:A40,LEN(A14:A40)>15),SUBSTITUTE(LEFT(s,FIND(" ",s)),"m","")+0)
C11C11=MID(A24,SEARCH("R",FILTER(A14:A40,LEN(A14:A40)>15),1)+1,2)+0
C13C13=MIN(FILTER(A14:A40,ISNUMBER(A14:A40)))
 
Upvote 0
Hi Peter, I feel like such a dunce. The true magnitude of my dunceness has shown through when I didn't consider c8 = a8 & c9=a9.

Regarding the other three formulas. Thank you very much. It works beautifully.

(Too close to the trees to see the forest I guess)
 
Upvote 0
Hi Peter, Just doing a bit more testing and C11 is not quite there. Where you have referenced MID(A24..., it is the A24 part that can move up and down. So if the text string is not in A24, it will yield a #VALUE error.

Really appreciate the help.
 
Upvote 0
Where you have referenced MID(A24...
Oops, I forgot that one. Try these (also adjusted for rows 8:28)

21 05 04.xlsm
ABC
7
8CanterburyTrackCanterbury
9Good (4)ConditionGood (4)
10Distance (m)1200
111Race Number1
12Class
132Time12:45
14
153
16
174
18
195
20
216
22
237
241200m R1 Vinery Stud Mdn Hcp
2512:45
26
27
28
Extract
Cell Formulas
RangeFormula
C8:C9C8=A8
C10C10=LET(s,FILTER(A8:A28,LEN(A8:A28)>15),SUBSTITUTE(LEFT(s,FIND(" ",s)),"m","")+0)
C11C11=LET(s,FILTER(A8:A28,LEN(A8:A28)>15),MID(s,SEARCH("R",s,1)+1,2)+0)
C13C13=MIN(FILTER(A8:A28,ISNUMBER(A8:A28)))
 
Upvote 0
Also, I was a little confused about your original formula for the distance. Would this shorter one also work for you?

Excel Formula:
=LET(s,FILTER(A8:A28,LEN(A8:A28)>15),LEFT(s,FIND("m",s)-1)+0)
 
Upvote 0
Hi Peter,

thanks for that. I just put this jalopy of formula together

=VALUE(MID(FILTER(A14:A40,LEN(A14:A40)>15),SEARCH("R",FILTER(A14:A40,LEN(A14:A40)>15),1)+1,2))

which did work, but yours is so much neater :)
 
Upvote 0
yep, the shorter one works great. Thanks.

This is a whole new world for me. I grew up on fortran 66 and 77. I'm an oldie, but a goodie (so my wife says)

thanks again.
 
Upvote 0
Hi Peter, would you have any idea why I am getting #SPILL errors.

Test.xlsx
ABCD
3
4
5Calculated Result
6Pasted DataMy Formula Attempt, using fixed cell locationsMr Excel Formulas
7
8Murray BridgeTrackMurray BridgeMurray Bridge
9Good (4)ConditionGood (4)Good (4)
10Distance (m)#VALUE!1200
111#VALUE!
12Race Number#VALUE!1
132#VALUE!
14Class
153
16Time12:00 AM12:35 PM
174
18
195
20
216
22
237
24
250:00
261200m R1 Murray Bridge Club (bm58)
2712:35
28
29
30
31
Sheet1
Cell Formulas
RangeFormula
C8C8=INDEX(A8:A28,1,1)
D8:D9D8=A8
C9C9=INDEX(A8:A28,2,1)
C10C10=VALUE(IF(FIND("m ",A30,1)=5,LEFT(A30,4),LEFT(A30,3)))
D10:D11D10=LET(s,FILTER(A7:A40,LEN(A7:A40)>15),LEFT(s,FIND("m",s)-1)+0)
C12C12=VALUE(MID(A30,SEARCH("R",A30,1)+1,2))
D12:D13D12=LET(s,FILTER(A8:A40,LEN(A8:A40)>15),MID(s,SEARCH("R",s,1)+1,2)+0)
C16C16=INDEX(A8:A34,18,1)
D16D16=MIN(FILTER(A14:A40,ISNUMBER(A14:A40)))
Dynamic array formulas.
 
Upvote 0
Hi Peter, I fixed the #spill error by using a length >20. Using a length >10 increased the spill range to 3 cells.

Where can i learn more about this?

thanks
 
Upvote 0

Forum statistics

Threads
1,216,101
Messages
6,128,837
Members
449,471
Latest member
lachbee

We've detected that you are using an adblocker.

We have a great community of people providing Excel help here, but the hosting costs are enormous. You can help keep this site running by allowing ads on MrExcel.com.
Allow Ads at MrExcel

Which adblocker are you using?

Disable AdBlock

Follow these easy steps to disable AdBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the icon in the browser’s toolbar.
2)Click on the "Pause on this site" option.
Go back

Disable AdBlock Plus

Follow these easy steps to disable AdBlock Plus

1)Click on the icon in the browser’s toolbar.
2)Click on the toggle to disable it for "mrexcel.com".
Go back

Disable uBlock Origin

Follow these easy steps to disable uBlock Origin

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back

Disable uBlock

Follow these easy steps to disable uBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back
Back
Top