[Solved] Array Formula Using Index, Match & Reg Expressions

Discuss the spreadsheet application
Post Reply
Mal F
Posts: 6
Joined: Thu Mar 06, 2014 9:31 am

[Solved] Array Formula Using Index, Match & Reg Expressions

Post by Mal F »

I am a new LibreOffice (4.2) user and in the process of converting my Excel files to Calc.
It has been going well but I have struck a problem that I have summarised in the attached Calc worksheet. (I have used the columns from my much larger worksheet in my example).

Basically I import names from a “First External Source” (Column “BL”), convert them to Last Name “IR”, First Name “IS” and match them to a “Second External Source”, Last Name “IT”, First Name “IU” to get the Indexed Value in “IV”.
The result is shown in Column “II” which currently shows “N/A” but should be the Indexed Value from “IV”.
e.g. M. White in BL5 should return -4.71 in II5.

I have no access to change anything in the First External Source but I can access the Second External Source although I would be reluctant to make any changes there.

I have broken the formula in II2:II7 down into smaller parts as shown in BL11:BM17.
The formula is an Array Formula and I have enabled Regular Expressions.

Have I made an error in the syntax or do I have a problem with Regular Expressions?

Any help or suggestions would be appreciated.

Thanks,
Mal
Attachments
Br Test Sheet 4.ods
Summarised Worksheet Example
(46.28 KiB) Downloaded 120 times
Last edited by Mal F on Fri Mar 07, 2014 7:56 am, edited 1 time in total.
LibreOffice 4.2 with Windows 7 64 bit
ken johnson
Volunteer
Posts: 918
Joined: Sun May 31, 2009 1:35 am
Location: Sydney, Australia

Re: Array Formula Using Index, Match and Regular Expressions

Post by ken johnson »

The regex seems not to be working, so maybe just assume first name is always initial...

Code: Select all

IF(BL2="";0;-INDEX($IV$2:$IV$7;MATCH(IR2&" "&LEFT(IS2;1);$IT$2:$IT$7&" "&LEFT($IU$2:$IU$7;1);0)))
Ken Johnson
Attachments
Match surname space first name initial.ods
(18.72 KiB) Downloaded 128 times
AOO 4.1.3 on Ms Windows 10
Help improve this forum by clicking the EDIT button on your first post then adding "[Solved]" to its heading once a solution to your problem has been provided.
User avatar
acknak
Moderator
Posts: 22756
Joined: Mon Oct 08, 2007 1:25 am
Location: USA:NJ:E3

Re: Array Formula Using Index, Match and Regular Expressions

Post by acknak »

I'm not so sure the regex is the source of the problem. I think it may have something to do with using an expression as the search array for MATCH. That's the part I've not seen before, and I'm not sure how it's supposed to work.

If I break things out into separate columns and use regular formulas instead of array formulas, then everything works--no errors at least.
 Edit: PS: 
No, I spoke too soon. Playing around a bit more, it seems that it's the combination of the regex and the expression search array. The regex works on a normal range and the MATCH works with a plain text search key but the regex does not work with the range expression.
Attachments
Br Test Sheet 4_acknak.ods
(14.69 KiB) Downloaded 128 times
AOO4/LO5 • Linux • Fedora 23
Mal F
Posts: 6
Joined: Thu Mar 06, 2014 9:31 am

Re: [Solved] Array Formula Using Index, Match & Reg Expressi

Post by Mal F »

Thanks for your replies.
Both options obviously work so I will work out the best for my circumstances.
You help is much appreciated.

Mal
LibreOffice 4.2 with Windows 7 64 bit
User avatar
acknak
Moderator
Posts: 22756
Joined: Mon Oct 08, 2007 1:25 am
Location: USA:NJ:E3

Re: [Solved] Array Formula Using Index, Match & Reg Expressi

Post by acknak »

Ok, there is actually a bug report for this:
Issue 117393: Implement regular expressions on arrays. You can register there and add your vote (up to two) or comment.
AOO4/LO5 • Linux • Fedora 23
Mal F
Posts: 6
Joined: Thu Mar 06, 2014 9:31 am

Re: [Solved] Array Formula Using Index, Match & Reg Expressi

Post by Mal F »

Thanks for that acknak.
This confirms what we suspected.

Mal
LibreOffice 4.2 with Windows 7 64 bit
Post Reply