+ Reply to Thread
Results 1 to 24 of 24

Concatenate in a formula to reference a different worksheet

  1. #1
    Registered User
    Join Date
    07-15-2012
    Location
    London
    MS-Off Ver
    Excel 2016
    Posts
    55

    Concatenate in a formula to reference a different worksheet

    I have a workbook with 32 sheets in it - A sheet for each day of the month, a Client list sheet and a totals sheets.

    What i'm doing is on the "Client" sheet the list of client's and i Vlookup cells on the "day" sheets to give me daily figures.

    So im using the following formula which works fine.

    =IFERROR(VLOOKUP("Total for account 76000/100830 on 76000/COMMHORI",'1st'!$H$1:$AF$1000,25,FALSE),"")

    The problem i have is have to change the sheet ref for every client of every day of the month (in this formula it is "1st" and it obviously will need to change to"2nd" etc).

    What i was was hoping to do was to concatenate the formula using a cell reference instead of the actual sheet name and then i could copy and paste it across.

    Any help would be most welcome!

  2. #2
    Forum Guru Pete_UK's Avatar
    Join Date
    12-31-2011
    Location
    Warrington, England
    MS-Off Ver
    Office 2019 (still learning)
    Posts
    24,723

    Re: Concatenate in a formula to reference a different worksheet

    You can do that using the INDIRECT function, where you would list your sheet names in one column and the VLOOKUP/INDIRECT formula will pick up the appropriate sheet name. Attach a sample workbook so we can see how your data is laid out.

    Hope this helps.

    Pete

  3. #3
    Forum Expert
    Join Date
    05-05-2015
    Location
    UK
    MS-Off Ver
    Microsoft Excel for Microsoft 365 MSO (Version 2402 Build 16.0.17328.20068) 64-bit
    Posts
    28,178

    Re: Concatenate in a formula to reference a different worksheet

    try

    =IFERROR(VLOOKUP("Total for account 76000/100830 on 76000/COMMHORI",INDIRECT("'" &A2 &"'!$H$1:$AF$1000"),25,FALSE),"")

    A2=Sheet name

  4. #4
    Forum Moderator davesexcel's Avatar
    Join Date
    02-19-2006
    Location
    Regina
    MS-Off Ver
    MS 365
    Posts
    13,481

    Re: Concatenate in a formula to reference a different worksheet

    If i had a formula like this
    Formula: copy to clipboard
    Please Login or Register  to view this content.

    Then wanted A1 to have a dropdown of worksheet names, it would look like this.
    Formula: copy to clipboard
    Please Login or Register  to view this content.
    Attached Files Attached Files

  5. #5
    Registered User
    Join Date
    07-15-2012
    Location
    London
    MS-Off Ver
    Excel 2016
    Posts
    55

    Re: Concatenate in a formula to reference a different worksheet

    help.xlsx


    I have taken some data off but you should get the gist

    Cheers

  6. #6
    Registered User
    Join Date
    07-15-2012
    Location
    London
    MS-Off Ver
    Excel 2016
    Posts
    55

    Re: Concatenate in a formula to reference a different worksheet

    Thanks for all your replies.

  7. #7
    Forum Guru Pete_UK's Avatar
    Join Date
    12-31-2011
    Location
    Warrington, England
    MS-Off Ver
    Office 2019 (still learning)
    Posts
    24,723

    Re: Concatenate in a formula to reference a different worksheet

    You can use this in B2 of the Totals sheet:

    =IFERROR(VLOOKUP("Total*",INDIRECT("'"&A2&"'!H:AF"),25,0),"")

    then copy down. Note the asterisk in the lookup value - it is looking for the first entry in column H that begins with the word "Total".

    Hope this helps.

    Pete

  8. #8
    Forum Guru samba_ravi's Avatar
    Join Date
    07-26-2011
    Location
    Hyderabad, India
    MS-Off Ver
    Excel 2021
    Posts
    8,914

    Re: Concatenate in a formula to reference a different worksheet

    =IFERROR(VLOOKUP("Total for account 76000/100830 on 76000/COMMHORI",INDIRECT("'"&C$1&"'!$H$1:$AF$1000"),25,FALSE),"")
    Please Login or Register  to view this content.
    try this
    Samba

    Say thanks to those who have helped you by clicking Add Reputation star.

  9. #9
    Forum Moderator davesexcel's Avatar
    Join Date
    02-19-2006
    Location
    Regina
    MS-Off Ver
    MS 365
    Posts
    13,481

    Re: Concatenate in a formula to reference a different worksheet

    Formula: copy to clipboard
    Please Login or Register  to view this content.

  10. #10
    Registered User
    Join Date
    07-15-2012
    Location
    London
    MS-Off Ver
    Excel 2016
    Posts
    55

    Re: Concatenate in a formula to reference a different worksheet

    Pete your 1 step ahead of me.
    I've realised that where i have used "Total for account 76000/100830" and you have used "Total*"
    what i really should do is have "Total for the Account" and then concatenate a cell reference to replace the account number and i can then copy down.
    I assume it would look something like this
    =IFERROR(VLOOKUP("Total for account"CONCATENATE,A2,INDIRECT("'"&$C$1&"'!H:AF"),25,0),"") does that look like im on the right road?

  11. #11
    Forum Expert
    Join Date
    05-05-2015
    Location
    UK
    MS-Off Ver
    Microsoft Excel for Microsoft 365 MSO (Version 2402 Build 16.0.17328.20068) 64-bit
    Posts
    28,178

    Re: Concatenate in a formula to reference a different worksheet

    =IFERROR(VLOOKUP("Total for account " & A2,INDIRECT("'" & $C$1 &"'!H1:AF1000"),25,FALSE),"")

  12. #12
    Registered User
    Join Date
    07-15-2012
    Location
    London
    MS-Off Ver
    Excel 2016
    Posts
    55

    Re: Concatenate in a formula to reference a different worksheet

    Thanks John.
    For some reason im getting a blank cell. when i try and use your formula.
    I looks like it should work .

  13. #13
    Forum Expert
    Join Date
    05-05-2015
    Location
    UK
    MS-Off Ver
    Microsoft Excel for Microsoft 365 MSO (Version 2402 Build 16.0.17328.20068) 64-bit
    Posts
    28,178

    Re: Concatenate in a formula to reference a different worksheet

    What cell is blank? With name in A2 (say "ABCDEF") you should get

    =IFERROR(VLOOKUP("Total for account ABCDEF", INDIRECT("'" & $C$1 &"'!H1:AF1000"),25,FALSE),"")

  14. #14
    Registered User
    Join Date
    07-15-2012
    Location
    London
    MS-Off Ver
    Excel 2016
    Posts
    55

    Re: Concatenate in a formula to reference a different worksheet

    The return cell C3 is blank.
    I was expecting the result you put down.
    I have this in cell C2 which is using the first cell with "Total for account" =IFERROR(VLOOKUP("Total for account*",INDIRECT("'"&$C$1&"'!H:AF"),25,0),"") (which was what pete provided)
    I have this in cell C3 and it works fine =IFERROR(VLOOKUP("Total for account 76000/110483 on 76000/COMMHORI",INDIRECT("'" &$C$1 &"'!$H$1:$AF$1000"),25,FALSE),"")
    When i try the formula =IFERROR(VLOOKUP("Total for account " & A2,INDIRECT("'" & $C$1 &"'!H1:AF1000"),25,FALSE),"") im getting a blank.
    Obviously im doing something wrong

  15. #15
    Forum Moderator davesexcel's Avatar
    Join Date
    02-19-2006
    Location
    Regina
    MS-Off Ver
    MS 365
    Posts
    13,481

    Re: Concatenate in a formula to reference a different worksheet

    Did you try the example I gave you, it works for the sample workbook you provided.

  16. #16
    Forum Expert
    Join Date
    05-05-2015
    Location
    UK
    MS-Off Ver
    Microsoft Excel for Microsoft 365 MSO (Version 2402 Build 16.0.17328.20068) 64-bit
    Posts
    28,178

    Re: Concatenate in a formula to reference a different worksheet

    Post your file (or sample of) with the "error".

    for C3 then

    cell A2=76000/110483 on 76000/COMMHORI

  17. #17
    Registered User
    Join Date
    07-15-2012
    Location
    London
    MS-Off Ver
    Excel 2016
    Posts
    55

    Re: Concatenate in a formula to reference a different worksheet

    I did try it but i want to all the client for each day on a single sheet.
    The account number is in cell A2 but it sits within a line of text on day sheet in H but i want the which has Total for account as it is also contained in the H but with different definition and that produces a different result.

  18. #18
    Registered User
    Join Date
    07-15-2012
    Location
    London
    MS-Off Ver
    Excel 2016
    Posts
    55

    Re: Concatenate in a formula to reference a different worksheet

    John that work. But you what im going to say now!
    really i only want the account number in that cell.
    Any idea?

  19. #19
    Forum Expert
    Join Date
    05-05-2015
    Location
    UK
    MS-Off Ver
    Microsoft Excel for Microsoft 365 MSO (Version 2402 Build 16.0.17328.20068) 64-bit
    Posts
    28,178

    Re: Concatenate in a formula to reference a different worksheet

    You will need to post a file so we can see how your data is organised.

  20. #20
    Registered User
    Join Date
    07-15-2012
    Location
    London
    MS-Off Ver
    Excel 2016
    Posts
    55

    Re: Concatenate in a formula to reference a different worksheet

    I have posted a sample earlier the file was called help.xls

  21. #21
    Forum Guru Pete_UK's Avatar
    Join Date
    12-31-2011
    Location
    Warrington, England
    MS-Off Ver
    Office 2019 (still learning)
    Posts
    24,723

    Re: Concatenate in a formula to reference a different worksheet

    Yes, but that file had the sheet name in column A of the Totals sheet - everyone since Post#8 seems to have assumed that the sheet name is in column C, so I'm confused. Where does the account number appear? I would suggest putting the account numbers across row 1 starting with B1, then you can produce a table using this formula in B2:

    =IFERROR(VLOOKUP("Total*"&B$1&"*",INDIRECT("'"&$A2&"'!H:AF"),25,0),"")

    then you can copy this across and down, as required.

    Hope this helps.

    Pete

  22. #22
    Registered User
    Join Date
    07-15-2012
    Location
    London
    MS-Off Ver
    Excel 2016
    Posts
    55

    Re: Concatenate in a formula to reference a different worksheet

    Good Morning Sorry if i have been giving conflicting info.

    Just explain exactly what i would like to achieve.

    I receive a daily sheet which i want to copy and paste into the corresponding day of the month ie data for the 15th will be pasted into sheet 15.

    On the "Client" sheet in A will be posted an account number format "76000/xxxx" and their name is in be B.

    So what i want to do is pull the daily commission number for each client on the Client sheet. So the figure for client AAA for the 3rd day of the month will be posted E2
    and then f2 would contain the figure for the 4th day.

    If you look on the daily data posted on say sheet 1 the daily total commission is in AF The problem is that column AF contains 2 versions so to make sure
    i get the right 1 i was looking up cell in H and the correct data is "Total for the account 76000/xxxx. (xxxx being the data that changes for each client.

    I hope this clears it up and once again thanks in advance for any help!
    Attached Files Attached Files

  23. #23
    Forum Guru Pete_UK's Avatar
    Join Date
    12-31-2011
    Location
    Warrington, England
    MS-Off Ver
    Office 2019 (still learning)
    Posts
    24,723

    Re: Concatenate in a formula to reference a different worksheet

    Put this in C2 of the clients sheet:

    =IFERROR(VLOOKUP("Total for account*"&$A2&"*",INDIRECT("'"&C$1&"'!H:AF"),25,0),"")

    then copy across and down as required.

    Hope this helps.

    Pete

  24. #24
    Registered User
    Join Date
    07-15-2012
    Location
    London
    MS-Off Ver
    Excel 2016
    Posts
    55

    Re: Concatenate in a formula to reference a different worksheet

    Pete thanks very much that sorted it right out!

+ Reply to Thread

Thread Information

Users Browsing this Thread

There are currently 1 users browsing this thread. (0 members and 1 guests)

Similar Threads

  1. Replies: 3
    Last Post: 11-29-2013, 05:33 AM
  2. Replies: 5
    Last Post: 02-06-2012, 12:36 PM
  3. Replies: 2
    Last Post: 07-26-2010, 11:02 AM
  4. Formula/Macro to reference from other Worksheet
    By Rizzu in forum Excel Programming / VBA / Macros
    Replies: 5
    Last Post: 10-09-2009, 12:58 AM
  5. concatenate a worksheet reference in vlookup
    By delaughd in forum Excel Formulas & Functions
    Replies: 2
    Last Post: 06-06-2008, 01:24 PM
  6. [SOLVED] Reference Worksheet Name variable in VBA formula
    By Mike in forum Excel Programming / VBA / Macros
    Replies: 2
    Last Post: 08-08-2006, 03:05 PM
  7. two worksheet reference formula help
    By chadhart in forum Excel Formulas & Functions
    Replies: 1
    Last Post: 06-02-2006, 06:50 PM
  8. Worksheet name / reference as a formula?
    By gabriel_e in forum Excel General
    Replies: 4
    Last Post: 01-24-2006, 08:25 AM

Bookmarks

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts

Search Engine Friendly URLs by vBSEO 3.6.0 RC 1