Mike Guest98

New Member
Joined
Jun 4, 2018
Messages
40
Hi

I’m using the following formula but would like to change it to include more than one result:


=IF(ISERROR(LOOKUP(2,1/(E36:E52<>""),E25:E50)),"",LOOKUP(2,1/(E25:E50<>""),E25:E50))


If for example the existing formula was placed in cell B5 but an additional two results could be added (if found) and the results would be placed in the adjacent cells of B6 and B7. I’ve tried and tried with no luck.

<style type="text/css">p { margin-bottom: 0.1in; direction: ltr; color: rgb(0, 0, 0); line-height: 115%; }p.western { font-family: "Times New Roman", serif; font-size: 12pt; }p.cjk { font-family: "Times New Roman", serif; font-size: 12pt; }p.ctl { font-family: "Times New Roman", serif; font-size: 12pt; }</style>
 

Some videos you may like

Excel Facts

How to calculate loan payments in Excel?
Use the PMT function: =PMT(5%/12,60,-25000) is for a $25,000 loan, 5% annual interest, 60 month loan.

Special-K99

Well-known Member
Joined
Nov 7, 2006
Messages
8,350
Formulas cant place values in other cells only VBA can do that.
You need to put formulas in B6 and B7

What are your additional values?
 

Mike Guest98

New Member
Joined
Jun 4, 2018
Messages
40
So if I break up the formula and put the following in cell B5 to say =IF(ISERROR(LOOKUP(2,1/(E25:E35<>""),E25:E35)),"",LOOKUP(2,1/(E25:E35<>""),E25:E35)) and then =IF(ISERROR(LOOKUP(2,1/(E46:E52<>""),E46:E52)),"",LOOKUP(2,1/(E46:E52<>"") in cell B6 I would get results for two cells. I could break it up more for 3 cells.

I'm not sure what you're referring to with additional values.
Thanks
 

Mike Guest98

New Member
Joined
Jun 4, 2018
Messages
40
Can I also ask if there is a way for the formula have an error if more than one result is found.
Thank-you
 

Special-K99

Well-known Member
Joined
Nov 7, 2006
Messages
8,350

ADVERTISEMENT

Cant you just shorten that to

=IFERROR(LOOKUP(2,1/(E25:E35<>""),E25:E35)),"")
 

Special-K99

Well-known Member
Joined
Nov 7, 2006
Messages
8,350
Im not sure what youre asking for in your original request.

Can you provide some output?
 

Mike Guest98

New Member
Joined
Jun 4, 2018
Messages
40

ADVERTISEMENT

That works, thanks. Is there a way to indicate an error if more than 1 result is found?
Thanks
 

Special-K99

Well-known Member
Joined
Nov 7, 2006
Messages
8,350
LOOKUP only returns one result, you'd need to use some other formula to pick up more than one result.

Usually takes the form of an array formula like

'{=IFERROR(INDEX($A$1:$A$5,SMALL(IF(($A$1:$A$5<>""),ROW($A$1:$A$5)),ROW(A1))-(ROW(A$1)-1),1),"")}

or non array

'=IFERROR(INDEX(A$3:A$100,AGGREGATE(15,6,ROW(A$3:A$100)/(A$3:A$100<>""),ROWS(A$3:A3))-(3-1),1),"")

Dont use them formulas, they wont work, they're just templates.
 

Special-K99

Well-known Member
Joined
Nov 7, 2006
Messages
8,350
Those formulas are usually used to remove unwanted cells thereby producing a list, a common problem is taking empty cells out of a column, hence the <>""
If you google for something like excel remove empty cells list you'll see lots of examples as it's a standard solution.
You'd need to change the condition.

'{=IFERROR(INDEX($A$1:$A$5,SMALL(IF(($A$1:$A$5<>""),ROW($A$1:$A$5)),ROW(A1))-(ROW(A$1)-1),1),"")}

or non array

'=IFERROR(INDEX(A$3:A$100,AGGREGATE(15,6,ROW(A$3:A$100)/(A$3:A$100<>""),ROWS(A$3:A3))-(3-1),1),"")

Red = Original List (range can be expanded to other columns to return specific column as per orange below - range in the condition shouldnt be expanded as you're only checking for one cell in a column)
Blue = Condition - Use (condition1)*(condition2) for AND (condition1)+(condition2) for OR - normal AND() OR() doesnt work
Green = First line of list
Orange = Column to return from the original list
 
Last edited:

Watch MrExcel Video

Forum statistics

Threads
1,122,472
Messages
5,596,354
Members
414,060
Latest member
hermanseck

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
Top