IF cell J4=\"string\", use formula xxx, if J4= \"string2\", use formula xxx1 Hel
ID: 3562446 • Letter: I
Question
IF cell J4="string", use formula xxx, if J4= "string2", use formula xxx1
Hello, I am trying to write a macro which automatically uses formulas according to actual month.
What I have till now is a macro that recognizes actual month by using formula SheetName. (Macro will be running from activesheet, which is named by months)
For example:
Sheet name: September > use =IF(F18="July, 2014",VLOOKUP(C18,'B&S July'!$A$18:$G$101,6,FALSE),IF(F18="August, 2014",VLOOKUP(C18,'B&S August'!$A$18:$G$173,6,FALSE),H18))
Sheet name: October > use =IF(F18="July, 2014",VLOOKUP(C18,'B&S July'!$A$18:$G$101,6,FALSE),IF(F18="August, 2014",VLOOKUP(C18,'B&S August'!$A$18:$G$173,6,FALSE),IF(F18="September, 2014",VLOOKUP(C18,'B&S September'!$A$18:$G$173,6,FALSE),H18)))
How should I continue with writing that macro? or is there better way how to achieve this?
Explanation / Answer
No need for macro,
Use this formula, It will take care your all sheets.
Ensure your sheet names are complete month name.
=IFERROR(VLOOKUP(C18,INDIRECT("'B&S "&LEFT(F18,FIND(",",F18)-1)&"'!$A$18:$G$1000"),6,FALSE),H18)
Hope it helps.