offset and match? question

ebsmcb

New Member
Joined
Jun 21, 2023
Messages
8
Office Version
  1. 365
Platform
  1. MacOS
I'm trying to return the cell contents -1 column away from the first occurrence of a repeating text string... See below for an example. I've tried using various combinations of offset and match to no avail.
sample #data 1data 2data 3data 4data 5etc
1return contents of orange text here345na
na
2
return contents of orange text here
10
8nanana
3
return contents of orange text here
16nananana
etc
etc
 

Excel Facts

Why does 9 mean SUM in SUBTOTAL?
It is because Sum is the 9th alphabetically in Average, Count, CountA, Max, Min, Product, StDev.S, StDev.P, Sum, VAR.S, VAR.P.
Hi & welcome to MrExcel.
Will the repeating string always be na?
 
Upvote 0
Hi and welcome to Mr

Try:

varios 21jun2023.xlsm
ABCDEFGH
1sample #data 1data 2data 3data 4data 5etc
215345nana
328108nanana
431616nananana
5etc 
Hoja2
Cell Formulas
RangeFormula
B2:B5B2=IFERROR(INDEX(C2:Z2,, MATCH("na",C2:Z2,0)-1),"")
 
Upvote 0
I that case try Dante's suggestion.
 
Upvote 0
Hi and welcome to Mr

Try:

varios 21jun2023.xlsm
ABCDEFGH
1sample #data 1data 2data 3data 4data 5etc
215345nana
328108nanana
431616nananana
5etc 
Hoja2
Cell Formulas
RangeFormula
B2:B5B2=IFERROR(INDEX(C2:Z2,, MATCH("na",C2:Z2,0)-1),"")
Hi and welcome to Mr

Try:

varios 21jun2023.xlsm
ABCDEFGH
1sample #data 1data 2data 3data 4data 5etc
215345nana
328108nanana
431616nananana
5etc 
Hoja2
Cell Formulas
RangeFormula
B2:B5B2=IFERROR(INDEX(C2:Z2,, MATCH("na",C2:Z2,0)-1),"")
The formula above =IFERROR(INDEX(C2:Z2,, MATCH("na",C2:Z2,0)-1),"") worked for the first row (returned "5", but returned "na" for 2nd and 3rd rows... Not sure why!
 
Upvote 0
How about
Excel Formula:
=IFNA(INDEX(C2:X2,XMATCH("na",C2:X2)-1),"none")
 
Upvote 0
Are you testing with the data you put in your first post?
Or is it other data?
If they are other data, you could put them here and also the result that you want.

Note XL2BB:
For the future, it would help greatly if you could give us the sample data in a form that we can copy to test with.
MrExcel has a tool called “XL2BB” that lets you post samples of your data that will allow us to copy/paste it to our Excel spreadsheets, so we can work with the same copy of data that you are. Instructions on using this tool can be found here: XL2BB Add-in
Note that there is also a "Test Here” forum on this board. This is a place where you can test using this tool (or any other posting techniques that you want to test) before trying to use those tools in your actual posts.
 
Upvote 0
OK... I'll try the copy/paste with XL2BB... See below. Still returning "na" in rows 2 and 3 for some reason. This is the actual data (pasted below). Thanks y'all!

Sample #Date/TimeFrequency (MHz)Profile TypeDepth (m)Cell Size (m)Cell Start (m)Cell1 Location (m)Cell1 Ve (m/s)Cell1 Vn (m/s)Cell1 Vu (m/s)Cell1 Vd (m/s)Cell1 Spd (m/s)Cell1 Dir (deg)Cell2 Location (m)Cell2 Ve (m/s)Cell2 Vn (m/s)Cell2 Vu (m/s)Cell2 Vd (m/s)Cell2 Spd (m/s)Cell2 Dir (deg)Cell3 Location (m)Cell3 Ve (m/s)Cell3 Vn (m/s)Cell3 Vu (m/s)Cell3 Vd (m/s)Cell3 Spd (m/s)Cell3 Dir (deg)Cell4 Location (m)Cell4 Ve (m/s)Cell4 Vn (m/s)Cell4 Vu (m/s)Cell4 Vd (m/s)Cell4 Spd (m/s)Cell4 Dir (deg)Cell5 Location (m)Cell5 Ve (m/s)Cell5 Vn (m/s)Cell5 Vu (m/s)Cell5 Vd (m/s)Cell5 Spd (m/s)Cell5 Dir (deg)Cell6 Location (m)Cell6 Ve (m/s)Cell6 Vn (m/s)Cell6 Vu (m/s)Cell6 Vd (m/s)Cell6 Spd (m/s)Cell6 Dir (deg)Cell7 Location (m)Cell7 Ve (m/s)Cell7 Vn (m/s)Cell7 Vu (m/s)Cell7 Vd (m/s)Cell7 Spd (m/s)Cell7 Dir (deg)Cell8 Location (m)Cell8 Ve (m/s)Cell8 Vn (m/s)Cell8 Vu (m/s)Cell8 Vd (m/s)Cell8 Spd (m/s)Cell8 Dir (deg)Cell9 Location (m)Cell9 Ve (m/s)Cell9 Vn (m/s)Cell9 Vu (m/s)Cell9 Vd (m/s)Cell9 Spd (m/s)Cell9 Dir (deg)Cell10 Location (m)Cell10 Ve (m/s)Cell10 Vn (m/s)Cell10 Vu (m/s)Cell10 Vd (m/s)Cell10 Spd (m/s)Cell10 Dir (deg)Cell11 Location (m)Cell11 Ve (m/s)Cell11 Vn (m/s)Cell11 Vu (m/s)Cell11 Vd (m/s)Cell11 Spd (m/s)Cell11 Dir (deg)Cell12 Location (m)Cell12 Ve (m/s)Cell12 Vn (m/s)Cell12 Vu (m/s)Cell12 Vd (m/s)Cell12 Spd (m/s)Cell12 Dir (deg)Cell13 Location (m)Cell13 Ve (m/s)Cell13 Vn (m/s)Cell13 Vu (m/s)Cell13 Vd (m/s)Cell13 Spd (m/s)Cell13 Dir (deg)Cell14 Location (m)Cell14 Ve (m/s)Cell14 Vn (m/s)Cell14 Vu (m/s)Cell14 Vd (m/s)Cell14 Spd (m/s)Cell14 Dir (deg)Cell15 Location (m)Cell15 Ve (m/s)Cell15 Vn (m/s)Cell15 Vu (m/s)Cell15 Vd (m/s)Cell15 Spd (m/s)Cell15 Dir (deg)Cell16 Location (m)Cell16 Ve (m/s)Cell16 Vn (m/s)Cell16 Vu (m/s)Cell16 Vd (m/s)Cell16 Spd (m/s)Cell16 Dir (deg)Cell17 Location (m)Cell17 Ve (m/s)Cell17 Vn (m/s)Cell17 Vu (m/s)Cell17 Vd (m/s)Cell17 Spd (m/s)Cell17 Dir (deg)Cell18 Location (m)Cell18 Ve (m/s)Cell18 Vn (m/s)Cell18 Vu (m/s)Cell18 Vd (m/s)Cell18 Spd (m/s)Cell18 Dir (deg)Cell19 Location (m)Cell19 Ve (m/s)Cell19 Vn (m/s)Cell19 Vu (m/s)Cell19 Vd (m/s)Cell19 Spd (m/s)Cell19 Dir (deg)Cell20 Location (m)Cell20 Ve (m/s)Cell20 Vn (m/s)Cell20 Vu (m/s)Cell20 Vd (m/s)Cell20 Spd (m/s)Cell20 Dir (deg)Cell21 Location (m)Cell21 Ve (m/s)Cell21 Vn (m/s)Cell21 Vu (m/s)Cell21 Vd (m/s)Cell21 Spd (m/s)Cell21 Dir (deg)Cell22 Location (m)Cell22 Ve (m/s)Cell22 Vn (m/s)Cell22 Vu (m/s)Cell22 Vd (m/s)Cell22 Spd (m/s)Cell22 Dir (deg)Cell23 Location (m)Cell23 Ve (m/s)Cell23 Vn (m/s)Cell23 Vu (m/s)Cell23 Vd (m/s)Cell23 Spd (m/s)Cell23 Dir (deg)Cell24 Location (m)Cell24 Ve (m/s)Cell24 Vn (m/s)Cell24 Vu (m/s)Cell24 Vd (m/s)Cell24 Spd (m/s)Cell24 Dir (deg)Cell25 Location (m)Cell25 Ve (m/s)Cell25 Vn (m/s)Cell25 Vu (m/s)Cell25 Vd (m/s)Cell25 Spd (m/s)Cell25 Dir (deg)Cell26 Location (m)Cell26 Ve (m/s)Cell26 Vn (m/s)Cell26 Vu (m/s)Cell26 Vd (m/s)Cell26 Spd (m/s)Cell26 Dir (deg)Cell27 Location (m)Cell27 Ve (m/s)Cell27 Vn (m/s)Cell27 Vu (m/s)Cell27 Vd (m/s)Cell27 Spd (m/s)Cell27 Dir (deg)Cell28 Location (m)Cell28 Ve (m/s)Cell28 Vn (m/s)Cell28 Vu (m/s)Cell28 Vd (m/s)Cell28 Spd (m/s)Cell28 Dir (deg)Cell29 Location (m)Cell29 Ve (m/s)Cell29 Vn (m/s)Cell29 Vu (m/s)Cell29 Vd (m/s)Cell29 Spd (m/s)Cell29 Dir (deg)Cell30 Location (m)Cell30 Ve (m/s)Cell30 Vn (m/s)Cell30 Vu (m/s)Cell30 Vd (m/s)Cell30 Spd (m/s)Cell30 Dir (deg)Cell31 Location (m)Cell31 Ve (m/s)Cell31 Vn (m/s)Cell31 Vu (m/s)Cell31 Vd (m/s)Cell31 Spd (m/s)Cell31 Dir (deg)Cell32 Location (m)Cell32 Ve (m/s)Cell32 Vn (m/s)Cell32 Vu (m/s)Cell32 Vd (m/s)Cell32 Spd (m/s)Cell32 Dir (deg)Cell33 Location (m)Cell33 Ve (m/s)Cell33 Vn (m/s)Cell33 Vu (m/s)Cell33 Vd (m/s)Cell33 Spd (m/s)Cell33 Dir (deg)Cell34 Location (m)Cell34 Ve (m/s)Cell34 Vn (m/s)Cell34 Vu (m/s)Cell34 Vd (m/s)Cell34 Spd (m/s)Cell34 Dir (deg)Cell35 Location (m)Cell35 Ve (m/s)Cell35 Vn (m/s)Cell35 Vu (m/s)Cell35 Vd (m/s)Cell35 Spd (m/s)Cell35 Dir (deg)Cell36 Location (m)Cell36 Ve (m/s)Cell36 Vn (m/s)Cell36 Vu (m/s)Cell36 Vd (m/s)Cell36 Spd (m/s)Cell36 Dir (deg)Cell37 Location (m)Cell37 Ve (m/s)Cell37 Vn (m/s)Cell37 Vu (m/s)Cell37 Vd (m/s)Cell37 Spd (m/s)Cell37 Dir (deg)Cell38 Location (m)Cell38 Ve (m/s)Cell38 Vn (m/s)Cell38 Vu (m/s)Cell38 Vd (m/s)Cell38 Spd (m/s)Cell38 Dir (deg)Cell39 Location (m)Cell39 Ve (m/s)Cell39 Vn (m/s)Cell39 Vu (m/s)Cell39 Vd (m/s)Cell39 Spd (m/s)Cell39 Dir (deg)Cell40 Location (m)Cell40 Ve (m/s)Cell40 Vn (m/s)Cell40 Vu (m/s)Cell40 Vd (m/s)Cell40 Spd (m/s)Cell40 Dir (deg)Cell41 Location (m)Cell41 Ve (m/s)Cell41 Vn (m/s)Cell41 Vu (m/s)Cell41 Vd (m/s)Cell41 Spd (m/s)Cell41 Dir (deg)Cell42 Location (m)Cell42 Ve (m/s)Cell42 Vn (m/s)Cell42 Vu (m/s)Cell42 Vd (m/s)Cell42 Spd (m/s)Cell42 Dir (deg)Cell43 Location (m)Cell43 Ve (m/s)Cell43 Vn (m/s)Cell43 Vu (m/s)Cell43 Vd (m/s)Cell43 Spd (m/s)Cell43 Dir (deg)Cell44 Location (m)Cell44 Ve (m/s)Cell44 Vn (m/s)Cell44 Vu (m/s)Cell44 Vd (m/s)Cell44 Spd (m/s)Cell44 Dir (deg)Cell45 Location (m)Cell45 Ve (m/s)Cell45 Vn (m/s)Cell45 Vu (m/s)Cell45 Vd (m/s)Cell45 Spd (m/s)Cell45 Dir (deg)Cell46 Location (m)Cell46 Ve (m/s)Cell46 Vn (m/s)Cell46 Vu (m/s)Cell46 Vd (m/s)Cell46 Spd (m/s)Cell46 Dir (deg)Cell47 Location (m)Cell47 Ve (m/s)Cell47 Vn (m/s)Cell47 Vu (m/s)Cell47 Vd (m/s)Cell47 Spd (m/s)Cell47 Dir (deg)Cell48 Location (m)Cell48 Ve (m/s)Cell48 Vn (m/s)Cell48 Vu (m/s)Cell48 Vd (m/s)Cell48 Spd (m/s)Cell48 Dir (deg)Cell49 Location (m)Cell49 Ve (m/s)Cell49 Vn (m/s)Cell49 Vu (m/s)Cell49 Vd (m/s)Cell49 Spd (m/s)Cell49 Dir (deg)Cell50 Location (m)Cell50 Ve (m/s)Cell50 Vn (m/s)Cell50 Vu (m/s)Cell50 Vd (m/s)Cell50 Spd (m/s)Cell50 Dir (deg)Cell51 Location (m)Cell51 Ve (m/s)Cell51 Vn (m/s)Cell51 Vu (m/s)Cell51 Vd (m/s)Cell51 Spd (m/s)Cell51 Dir (deg)
15/16/23 14:43yellow highlight here3MHzIC1.260.10.150.2-0.4360.085-0.073-0.1550.444281.0320.3-0.707-0.086-0.058-0.1960.712263.0650.4-0.8380.6210.0070.0211.043306.540.5-0.933-0.216-0.0650.1030.958256.9650.6-0.334-0.162-0.129-0.0530.371244.1250.7-0.740.352-0.068-0.0460.819295.4390.8-0.3610.469-0.0820.0620.592322.4140.9-0.246-0.068-0.1920.050.255254.548#N/A#N/A#N/A#N/A#N/A#N/A#N/A#N/A#N/A#N/A#N/A#N/A#N/A#N/A#N/A#N/A#N/A#N/A#N/A#N/A#N/A#N/A#N/A#N/A#N/A#N/A#N/A#N/A#N/A#N/A#N/A#N/A#N/A#N/A#N/A#N/A#N/A#N/A#N/A#N/A#N/A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#N/A#N/A#N/A#N/A
25/16/23 14:43yellow highlight here3MHzHD1.230.020.110.12-0.5340.2570.0090.0140.593295.70.14-0.5450.2680.0110.0190.607296.1850.16-0.5440.2570.0080.0260.602295.2870.18-0.5510.2550.0070.0270.607294.8340.2-0.5190.2110.030.0660.56292.1240.22-0.5130.2020.0280.0690.551291.4930.24-0.5930.312-0.0140.0050.67297.7510.26-0.5350.2060.0140.060.573291.0590.28-0.5750.26300.0320.632294.5790.3-0.5490.2280.0050.0310.594292.5530.32-0.5540.2240.0060.0370.598292.0150.34-0.5770.219-0.0020.0450.617290.7840.36-0.5550.2290.0040.0380.6292.4220.38-0.5310.2330.0140.0230.58293.6920.4-0.5050.2760.018-0.0160.576298.6580.42-0.4780.2150.0290.0130.524294.2180.44-0.4330.2180.04-0.0030.485296.7240.46-0.4550.2170.032-0.0020.504295.4980.48-0.5690.166-0.0050.0570.593286.2640.5-0.4570.2450.031-0.0110.519298.1960.52-0.570.1760.0030.0650.597287.1590.54-0.4590.2540.031-0.0130.525298.9590.56-0.4520.2150.031-0.0020.501295.4390.58-0.5620.1510.0030.0680.582285.0390.6-0.5020.30.013-0.050.585300.8630.62-0.490.2580.032-0.0320.554297.7680.64-0.5030.2550.031-0.0350.564296.8830.66-0.4740.2640.046-0.0070.543299.1160.68-0.5990.208-0.0050.0460.634289.1490.7-0.510.310.02-0.0290.597301.2930.72-0.490.320.015-0.0050.585303.1470.74-0.5820.276-0.0140.0160.644295.3720.76-0.5570.271-0.011-0.0170.619295.9450.78-0.5510.288-0.016-0.0240.622297.5950.8-0.5270.262-0.024-0.0150.589296.4340.82-0.540.186-0.010.060.571289.0060.84-0.5590.184-0.010.0340.589288.2190.86-0.4990.181-0.0170.0450.531289.9370.88-0.5340.3240.0150.0720.625301.2470.9-0.5220.3250.0130.0750.615301.9070.92-0.4470.196-0.0020.0490.488293.6760.94-0.4760.247-0.0180.0210.536297.4250.96-0.5190.4130.0110.0410.663308.5110.98-0.4820.3890.005-0.0120.619308.9051-0.4870.3540.0140.0180.602306.0131.02-0.4770.3160.001-0.0290.572303.5231.04-0.5830.3790.0130.0680.695303.0271.06-0.5610.3730.0080.0720.674303.6191.08-0.6660.2950.0570.0360.728293.891#N/A#N/A#N/A#N/A#N/A#N/A#N/A#N/A#N/A#N/A#N/A#N/A#N/A#N/A
 
Upvote 0
The problem is the cells do not have na, they have #N/A which is a totally different thing.
Try
Excel Formula:
=TAKE(FILTER(F2:NA2,NOT(ISNA(F2:NA2))),,-1)
 
Upvote 0
Solution

Forum statistics

Threads
1,224,823
Messages
6,181,181
Members
453,022
Latest member
Mohamed Magdi Tawfiq Emam

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