Combining LOOKUP and OR (in lookup_vector?)

Richard JIBS

New Member
Joined
Feb 3, 2015
Messages
13
Hello,

I have a spreadsheet that looks like this. The first number in column B (eg 20) is entered manually, then the numbers below it automatically become -1 the nearest cell above that does not contain "n" once the date in column A is reached. I have this working fine.

COLUMN ACOLUMN B
2016-05-02 [=TODAY()]SESSION
2016-03-2120
2016-03-2819
2016-04-0418
2016-04-11n
2016-04-1817
2016-04-25x
2016-05-0216
2016-05-09

<tbody>
</tbody>

In column B I currently have this formula filled down:
=IF(A3<=A$1,LOOKUP(2,1/($B$2:B2<>"n"),$B$2:B2-1),"")

This works for cells containing "n". But I need it to work for "n" OR "x". In the example above I can't get session 16 to appear as it follows an x.

I have tried adding OR in different places but it doesn't seem to be working – I could be doing it wrong though!

Could you help me amend the formula to allow for "n" or "x" please?

Thanks,

Richard
 
Last edited:

Excel Facts

Can a formula spear through sheets?
Use =SUM(January:December!E7) to sum E7 on all of the sheets from January through December
It doesn't seem to work in cell B8, where I want 16 to appear.

If I uses this formula it returns 19, as though it can only look at the first cell in the range (B2) and not the most recent cell not containing n or x (B6).
=IF(A8<=A$1,LOOKUP(2,1/(OR($B$2:B7<>{"n","x"})),$B$2:B7-1),"")
 
Upvote 0
Found a solution that works. It's not specifically for n and x, but any text, so still works for my spreadsheet.

=IF(A3<=A$1,LOOKUP(2,1/(NOT(ISTEXT($B$2:B2))),$B$2:B2-1),"")
 
Upvote 0

Forum statistics

Threads
1,214,798
Messages
6,121,630
Members
449,041
Latest member
Postman24

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