We’d like to remind Forumites to please avoid political debate on the Forum.
This is to keep it a safe and useful space for MoneySaving discussions. Threads that are – or become – political in nature may be removed in line with the Forum’s rules. Thank you for your understanding.
📨 Have you signed up to the Forum's new Email Digest yet? Get a selection of trending threads sent straight to your inbox daily, weekly or monthly!
The Forum now has a brand new text editor, adding a bunch of handy features to use when creating posts. Read more in our how-to guide
Excel Code Logic
choyaa
Posts: 226 Forumite
in Techie Stuff
Hi,
I had some trouble yesterday with Excel coding and I received various amounts of help on here. After much trial and error I finally got the code to work, however it doesn't make complete sense. Can someone explain the logic to the following code please?
=IF(RIGHT('tab2'!G2,4)="2016",VLOOKUP(A30,'tab2'!A:IY,MATCH($P$29,'tab2'!$1:$1,0),0),VLOOKUP(A30,'tab2'!A:IY,MATCH(tab1!$P$28,'tab2'!$1:$1,0),0))
I had some trouble yesterday with Excel coding and I received various amounts of help on here. After much trial and error I finally got the code to work, however it doesn't make complete sense. Can someone explain the logic to the following code please?
=IF(RIGHT('tab2'!G2,4)="2016",VLOOKUP(A30,'tab2'!A:IY,MATCH($P$29,'tab2'!$1:$1,0),0),VLOOKUP(A30,'tab2'!A:IY,MATCH(tab1!$P$28,'tab2'!$1:$1,0),0))
0
Comments
-
It says if the right 4 characters on tab2 are equal to 2016 then run a vlookup and match it to p29 tab2 and if not match to p280
-
And why did you need a NEW thread about the exact same thing? (How many threads is this now about the same "project"?)
All the poster above has done is give the same basic explanation that I gave you in the other thread. (The VLOOKUP/MATCH formula was explained to you in your first thread).0 -
Can I ask why the second ",0)" is used after each VLookup? You already used this once within the initial lookup.0
-
VLOOKUP has 4 parameters ... Search Term, Source Array, Column Number, True/False
The ,0) is the True/False parameter ... 0 = FALSE
The same VLOOKUP formula is needed in each part of the IF command, one to return P29 match, and the other to return P28 match.
Of course there may be a more elegant way of achieving what the OP is seeking - feel free to advise on this.
0
This discussion has been closed.
Confirm your email address to Create Threads and Reply
Categories
- All Categories
- 353.5K Banking & Borrowing
- 254.1K Reduce Debt & Boost Income
- 455K Spending & Discounts
- 246.6K Work, Benefits & Business
- 602.9K Mortgages, Homes & Bills
- 178.1K Life & Family
- 260.6K Travel & Transport
- 1.5M Hobbies & Leisure
- 16K Discuss & Feedback
- 37.7K Read-Only Boards