General location and Restrict location

RZoig

New Member
Joined
Jul 10, 2013
Messages
48
Office Version
  1. 365
Platform
  1. Windows
Hello,

I've searched several threads but I couldn´t find one that could help.

I'm trying to find a formula and a VBA function that is able to return the location of a string in a sheet (A) and also within a restricted area (B).

This is what I want for each Output (A and B) with 16.03 for Reference Input:

A. General reference
ABCDE
18.008.308.158.059.00
212.0512.1512.1012.2013.00
314.0014.0214.0514.0814.40
416.0116.0516.0315.5916.20
518.0718.1018.0818.1517.56
620.0220.1220.2020.1021.00
REF->16.03
Output ->C4
B. Restricted reference
2A3A4A5A6A
PHA18.008.308.158.059.00
PHA212.0512.1512.1012.2013.00
PHA314.0014.0214.0514.0814.40
PHA416.0116.0516.0315.5916.20
PHA518.0718.1018.0818.1517.56
PHA620.0220.1220.2020.1021.00
REF->16.03
Output -> 4A.PHA4

<tbody>
</tbody>

<tbody>
</tbody>

So:
In 'A' I want the location of 16.03 in a Excel sheet (C4 in my example)
In 'B' I want references of 16.03 within a table separated with a '.' (4A.PHA4 in my example).

A formula and a VBA function solution would be super great, but only the formula would do nicely!

Thank You
Rui
 

Excel Facts

Do you hate GETPIVOTDATA?
Prevent GETPIVOTDATA. Select inside a PivotTable. In the Analyze tab of the ribbon, open the dropown next to Options and turn it off
A:
Code:
=if(countif($a$1:$e$6,$f$9)<>1,"-",char(code("A")-1+sumproduct(column($a$1:$e$6)*($a$1:$e$6=$f$9)))&sumproduct(row($a$1:$e$6)*($a$1:$e$6=$f$9)))
B:
Code:
=if(countif($b$2:$f$7,$f$9)<>1,"-",index($1:$1,sumproduct(column($b$2:$f$7)*($b$2:$f$7=$f$9)))&"."&index($a:$a,sumproduct(row($b$2:$f$7)*($b$2:$f$7=$f$9))))
 
Last edited:
Upvote 0
Stunnrock,

For the time being let´s suppose we're dealing with unique records, i suppose.

Code B:
Fantastic. I'm still depicting what you've done, but it works fine.

Code A:
Something's missing or I adjusted poorly (I use ';' in my regional settings instead of ',') . Result was a minus symbol (-).
No 'C4' as output.

Thanks!
Could you help me a little bit more with A?
 
Upvote 0
Stunnrock

Code A:
Looked again and "or I adjusted poorly" is the right answer. So, amazing. Thank you! It worked of course.

Now I'll have to find how SumProduct is related to find strings! I use it only for calculations not as a reference tool!
How Odd!!

Thanks again!
Rui
 
Upvote 0

Forum statistics

Threads
1,214,782
Messages
6,121,532
Members
449,037
Latest member
tmmotairi

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