simplifying a complex formula and selecting a changing range

sarlo00

Board Regular
Joined
Nov 13, 2002
Messages
105
I have a sheet (call this sheet Sheet2!) that I've had help on in several other posts which looks like this:
Book2
ABCDEF
1THEABCCOMPANYBCA-ITSCustomPPO-0
2BCCITSCustomPPOITSCustom15
3BCD---0
4BCE---0
5BCF---0
6BCG---0
7BCHITSCustom-20
8BCJ---0
9BCKITSCustom--3
10BCNITSCustomPPO--914
11BCO---0
12BCPITSCustomPPO--8
13BCQITSCustomPPO--16
14BCT---0
15BCV---0
16BCWITSCustomPPO--30
17BCY---0
18BCZITSCustomPPO--532
Sheet2
 
Re: simplifying a complex formula and selecting a changing r

As response to your last post: I think I posted every formula the exhibit contains in the text of the post.


sarlo00 said:
Would someone help me understanding the use of REPT("z",255)?

It's largest string in lexical ascending order.

LOOKUP(REPT("z",255),A1:A20) returns the contents of the lowest row with text data in it?

Yes.

MATCH(REPT("z",255),A1:A20) returns the row number of the largest text string in Column A?

Or does it return the row number of the last text string in Column A?

It returns the position of the last cell in use (with a text value) in the range, not the row number of the last cell in use. Sometimes the position and the row coincide.
 
Upvote 0

Excel Facts

Copy formula down without changing references
If you have =SUM(F2:F49) in F50; type Alt+' in F51 to copy =SUM(F2:F49) to F51, leaving the formula in edit mode. Change SUM to COUNT.
Re: simplifying a complex formula and selecting a changing r

Aladin,
I was able to replicate your worksheet in a sample worksheet. When I used the formulas in the worksheet that I am working on however, the following formula is giving me problems.

=IF(ISNA(D16),#N/A,MATCH(IF(A16<>"",A16,LOOKUP(REPT("z",255),$A$1:A1)),Custom!A:A))

The "start" column returns the correct value of 16. The "end" column, containing the previous formula, is returning 106. The Custom! sheet which contains similar data as my example Sheet2! has 107 rows worth of data. Since cell D16 is not #N/A, the formula evaluates the MATCH. Since cell A16 is not blank, the MATCH formula simplifies to

MATCH("THE ABC COMPANY",Custom!A:A)

The ABC Company occupies rows 16 through 33 in the Custom! sheet. The formula returns 106 though????? :oops:
 
Upvote 0
Re: simplifying a complex formula and selecting a changing r

sarlo00 said:
Aladin,
I was able to replicate your worksheet in a sample worksheet. When I used the formulas in the worksheet that I am working on however, the following formula is giving me problems.

=IF(ISNA(D16),#N/A,MATCH(IF(A16<>"",A16,LOOKUP(REPT("z",255),$A$1:A1)),Custom!A:A))

The "start" column returns the correct value of 16. The "end" column, containing the previous formula, is returning 106. The Custom! sheet which contains similar data as my example Sheet2! has 107 rows worth of data. Since cell D16 is not #N/A, the formula evaluates the MATCH. Since cell A16 is not blank, the MATCH formula simplifies to

MATCH("THE ABC COMPANY",Custom!A:A)

The ABC Company occupies rows 16 through 33 in the Custom! sheet. The formula returns 106 though????? :oops:

Sarl,

Assuming that the data is sorted on the company column, one possibility is that the company names are misspelled or have additional chars like a space around. Try first to apply ASAP Utilities on the company column. It's freely downloadable from asap-utilities.com.
 
Upvote 0
Re: simplifying a complex formula and selecting a changing r

The Company Name column in the Custom! sheet was not sorted. After sorting, the formula worked. So, the MATCH formula works similarly to Vlookup in as much as the source data needs to be sorted. Great! I'll add that info to my Excel file ... in my brain. :wink:

Thanks again Aladin!
You amazingly always have the answers. :pray:
 
Upvote 0

Forum statistics

Threads
1,215,526
Messages
6,125,329
Members
449,218
Latest member
Excel Master

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