+ Reply to Thread
Results 1 to 22 of 22

Formula to extract Value from Sheet

  1. #1
    Forum Contributor
    Join Date
    07-12-2018
    Location
    South Africa
    MS-Off Ver
    Office 2021
    Posts
    2,726

    Formula to extract Value from Sheet

    I have value in Col D on sheet "BT8 Intercompany Debtors"


    I have tried to set up a formula to extract he value in Col D in the same row as Col B where "Total" occurs for the 1st time below text on this sheet in Col A "Southern & Eastern 8"

    Please Login or Register  to view this content.

    I get a blank , but result should be -6194.16


    Kindly amend my formula
    Attached Files Attached Files
    Last edited by Howardc1001; 03-25-2024 at 03:26 AM.

  2. #2
    Forum Moderator AliGW's Avatar
    Join Date
    08-10-2013
    Location
    Retired in Ipswich, Suffolk, but grew up in Sawley, Derbyshire (England)
    MS-Off Ver
    MS 365 Subscription Insider Beta Channel v. 2404 (Windows 11 22H2 64-bit)
    Posts
    80,940

    Re: Formula to extract Value from Sheet

    Well, for starters you need to use the correct cell reference in the INDIRECT:

    Please Login or Register  to view this content.
    Last edited by AliGW; 03-25-2024 at 03:49 AM.
    Ali


    Enthusiastic self-taught user of MS Excel who's always learning!
    Don't forget to say "thank you" in your thread to anyone who has offered you help.
    You can reward them by clicking on * Add Reputation below their user name on the left, if you wish.

    Forum Rules (updated August 2023): please read them here.

  3. #3
    Forum Moderator AliGW's Avatar
    Join Date
    08-10-2013
    Location
    Retired in Ipswich, Suffolk, but grew up in Sawley, Derbyshire (England)
    MS-Off Ver
    MS 365 Subscription Insider Beta Channel v. 2404 (Windows 11 22H2 64-bit)
    Posts
    80,940

    Re: Formula to extract Value from Sheet

    Try this:

    =LET(c,MATCH("Southern & Eastern 8",INDIRECT("'" & A2 & "'!A:A"),0),f,FILTER(ROW(INDIRECT("'"&A2&"'!B:B")),INDIRECT("'"&A2&"'!B:B")="Total"),INDEX(INDIRECT("'" & A2 & "'!D:D"),XLOOKUP(c,f,f,,1)))
    Attached Files Attached Files
    Last edited by AliGW; 03-25-2024 at 04:10 AM. Reason: Workbook updated with explanation.

  4. #4
    Forum Contributor
    Join Date
    07-12-2018
    Location
    South Africa
    MS-Off Ver
    Office 2021
    Posts
    2,726

    Re: Formula to extract Value from Sheet

    My Apologies Ali

    Thank for your formula , but this results in a blank. I have attached the workbook showing the correct result in C2
    Attached Files Attached Files

  5. #5
    Forum Moderator AliGW's Avatar
    Join Date
    08-10-2013
    Location
    Retired in Ipswich, Suffolk, but grew up in Sawley, Derbyshire (England)
    MS-Off Ver
    MS 365 Subscription Insider Beta Channel v. 2404 (Windows 11 22H2 64-bit)
    Posts
    80,940

    Re: Formula to extract Value from Sheet

    See post #3 for a solution.

  6. #6
    Forum Contributor
    Join Date
    07-12-2018
    Location
    South Africa
    MS-Off Ver
    Office 2021
    Posts
    2,726

    Re: Formula to extract Value from Sheet

    Thanks Ali. Have just seen your post #3 which gives the correct result

  7. #7
    Forum Moderator AliGW's Avatar
    Join Date
    08-10-2013
    Location
    Retired in Ipswich, Suffolk, but grew up in Sawley, Derbyshire (England)
    MS-Off Ver
    MS 365 Subscription Insider Beta Channel v. 2404 (Windows 11 22H2 64-bit)
    Posts
    80,940

    Re: Formula to extract Value from Sheet

    Glad to have helped.

    If that takes care of your original question, please choose Thread Tools from the menu link above and mark this thread as SOLVED. You can also access the SOLVED tag by editing the opening post and choosing SOLVED from the drop-down to the left of the title box.

    Also, if you have not already done so, remember that you can reward anyone who offered you help towards a solution for your issue by clicking the small star icon (* Add Reputation) located in the lower left corner of the post in which the help was given. By doing so you can add to the reputation(s) of each of those who offered help.

  8. #8
    Forum Moderator AliGW's Avatar
    Join Date
    08-10-2013
    Location
    Retired in Ipswich, Suffolk, but grew up in Sawley, Derbyshire (England)
    MS-Off Ver
    MS 365 Subscription Insider Beta Channel v. 2404 (Windows 11 22H2 64-bit)
    Posts
    80,940

    Re: Formula to extract Value from Sheet

    Just shout if you need me to explain the formula.

  9. #9
    Forum Moderator AliGW's Avatar
    Join Date
    08-10-2013
    Location
    Retired in Ipswich, Suffolk, but grew up in Sawley, Derbyshire (England)
    MS-Off Ver
    MS 365 Subscription Insider Beta Channel v. 2404 (Windows 11 22H2 64-bit)
    Posts
    80,940

    Re: Formula to extract Value from Sheet

    For completeness:

    AliGW on MS365 Beta Channel (Windows 11) 64 bit

    F
    G
    H
    I
    J
    K
    L
    2
    c
    f
    XLOOKUP
    INDEX
    c
    =MATCH("Southern & Eastern 8",INDIRECT("'" & A2 & "'!A:A"),0)
    3
    14
    22
    22
    -6194.16
    f
    =FILTER(ROW(INDIRECT("'"&A2&"'!B:B")),INDIRECT("'"&A2&"'!B:B")="Total")
    4
    30
    XLOOKUP
    =XLOOKUP(F3,G3#,G3#,,1)
    5
    INDEX
    =INDEX(INDIRECT("'" & A2 & "'!D:D"),H3)
    6
    7
    c
    Finds the row on which the criterion appears.
    8
    f
    Finds all of the rows where 'Total' appears.
    9
    XLOOKUP
    Finds the closest row in f that is equal to or larger than c.
    10
    INDEX
    Matches a value in D that matches the row found in the XLOOKUP.
    Sheet: Macro

  10. #10
    Forum Moderator Glenn Kennedy's Avatar
    Join Date
    07-08-2012
    Location
    Digital Nomad... occasionally based in Ireland.
    MS-Off Ver
    O365 (PC) V 2403
    Posts
    44,063

    Re: Formula to extract Value from Sheet

    I would not use FILTER with whole column references. It will check EVERY row (1,000,000+++) of them every time it is called in the formula. Given that you HAVE to use INDIRECT, a volatile function that updates EVERY time ANYTHING changes, you may find performance gets very slow. What's wrong simply with this:

    =INDEX(INDIRECT("'"&A2&"'!D:D"),MATCH("Total",INDIRECT("'"&A2&"'!B:B"),0))

    or have I missed the point somewhere?
    Attached Files Attached Files
    Glenn




    None of us get paid for helping you... we do this for fun. So DON'T FORGET to say "Thank You" to all who have freely given some of their time to help YOU.

    Temporary addition of accented to illustrate ongoing problem to the TT: L? fh?ile P?draig sona dhaoibh

  11. #11
    Forum Moderator AliGW's Avatar
    Join Date
    08-10-2013
    Location
    Retired in Ipswich, Suffolk, but grew up in Sawley, Derbyshire (England)
    MS-Off Ver
    MS 365 Subscription Insider Beta Channel v. 2404 (Windows 11 22H2 64-bit)
    Posts
    80,940

    Re: Formula to extract Value from Sheet

    ... or have I missed the point somewhere?
    I believe you have. It's the first occurrance of "Total" AFTER the criterion. The source worksheet is only an excerpt of the data, as far as I am aware.

    I would not use FILTER with whole column references.
    Neither would I, but it doesn't mean it can't be used. The OP could easily limit the column references.

  12. #12
    Forum Moderator Glenn Kennedy's Avatar
    Join Date
    07-08-2012
    Location
    Digital Nomad... occasionally based in Ireland.
    MS-Off Ver
    O365 (PC) V 2403
    Posts
    44,063

    Re: Formula to extract Value from Sheet

    Indeed. You are probably correct. However, the warning about whole column references in FILTER stands.

  13. #13
    Forum Moderator AliGW's Avatar
    Join Date
    08-10-2013
    Location
    Retired in Ipswich, Suffolk, but grew up in Sawley, Derbyshire (England)
    MS-Off Ver
    MS 365 Subscription Insider Beta Channel v. 2404 (Windows 11 22H2 64-bit)
    Posts
    80,940

    Re: Formula to extract Value from Sheet

    Absolutely agree on full column references, but as I said, not my choice.

  14. #14
    Forum Moderator Glenn Kennedy's Avatar
    Join Date
    07-08-2012
    Location
    Digital Nomad... occasionally based in Ireland.
    MS-Off Ver
    O365 (PC) V 2403
    Posts
    44,063

    Re: Formula to extract Value from Sheet

    In that case, I'd use this, which takes 0.004 seconds to calculate 100 cells, as opposed to FILTER, which takes 3.2 seconds to calculate 100 cells.

    =LET(A,INDIRECT("'"&$A$2&"'!A:D"),B,MATCH("Southern & Eastern 8",INDEX(A,,1),0),C,INDEX(A,B,2):INDEX(A,1000000,2),D,INDEX(A,B,4):INDEX(A,1000000,4),INDEX(D,MATCH("Total",C,0)))

    The end point (red) is irrelevant, as the formula stops when it finds the first match.

  15. #15
    Forum Moderator AliGW's Avatar
    Join Date
    08-10-2013
    Location
    Retired in Ipswich, Suffolk, but grew up in Sawley, Derbyshire (England)
    MS-Off Ver
    MS 365 Subscription Insider Beta Channel v. 2404 (Windows 11 22H2 64-bit)
    Posts
    80,940

    Re: Formula to extract Value from Sheet

    This would be an option without full column references:

    =LET(c,MATCH("Southern & Eastern 8",INDIRECT("'" & A2 & "'!A1:A10000"),0),f,FILTER(ROW(INDIRECT("'"&A2&"'!B1:B10000")),INDIRECT("'"&A2&"'!B1:B10000")="Total"),INDEX(INDIRECT("'" & A2 & "'!D1:D10000"),XLOOKUP(c,f,f,,1)))

  16. #16
    Forum Moderator Glenn Kennedy's Avatar
    Join Date
    07-08-2012
    Location
    Digital Nomad... occasionally based in Ireland.
    MS-Off Ver
    O365 (PC) V 2403
    Posts
    44,063

    Re: Formula to extract Value from Sheet

    ... which reduces calculation time to a much more respectable 0.04 seconds.

  17. #17
    Forum Moderator AliGW's Avatar
    Join Date
    08-10-2013
    Location
    Retired in Ipswich, Suffolk, but grew up in Sawley, Derbyshire (England)
    MS-Off Ver
    MS 365 Subscription Insider Beta Channel v. 2404 (Windows 11 22H2 64-bit)
    Posts
    80,940

    Re: Formula to extract Value from Sheet

    Or (to allow for each range to be defined once only):

    =LET(a,INDIRECT("'" & A2 & "'!A1:A10000"),b,INDIRECT("'"&A2&"'!B1:B10000"),c,MATCH("Southern & Eastern 8",a,0),d,INDIRECT("'" & A2 & "'!D1:D10000"),f,FILTER(ROW(b),b="Total"),INDEX(d,XLOOKUP(c,f,f,,1)))

  18. #18
    Forum Contributor
    Join Date
    07-12-2018
    Location
    South Africa
    MS-Off Ver
    Office 2021
    Posts
    2,726

    Re: Formula to extract Value from Sheet

    Thanks for your reply Glenn

    I need to extract the value in Col D in same row as "Total" in Col B ,where "Total" occurs for the first time after text "Southern & Eastern 8" in Col A

  19. #19
    Forum Moderator Glenn Kennedy's Avatar
    Join Date
    07-08-2012
    Location
    Digital Nomad... occasionally based in Ireland.
    MS-Off Ver
    O365 (PC) V 2403
    Posts
    44,063

    Re: Formula to extract Value from Sheet

    Refer to Post 14!!

  20. #20
    Forum Contributor
    Join Date
    07-12-2018
    Location
    South Africa
    MS-Off Ver
    Office 2021
    Posts
    2,726

    Re: Formula to extract Value from Sheet

    This formula also works

    Please Login or Register  to view this content.

  21. #21
    Forum Expert
    Join Date
    10-19-2021
    Location
    Brazil
    MS-Off Ver
    Office 365 V2401 w/ Win10 Home 64 Bit
    Posts
    2,014

    Re: Formula to extract Value from Sheet

    Reducing with LET() the Howardc1001 formula.

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

  22. #22
    Forum Expert
    Join Date
    10-19-2021
    Location
    Brazil
    MS-Off Ver
    Office 365 V2401 w/ Win10 Home 64 Bit
    Posts
    2,014

    Re: Formula to extract Value from Sheet

    Tks for the feedback, glad to also have helped.

+ 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. [SOLVED] Formula to Extract Month and Year from Sheet Name
    By Howardc1001 in forum Excel Formulas & Functions
    Replies: 5
    Last Post: 12-19-2023, 11:56 AM
  2. [SOLVED] Formula to Extract first Date from Sheet
    By Howardc1001 in forum Excel Formulas & Functions
    Replies: 7
    Last Post: 08-01-2023, 11:24 PM
  3. Formula to extract values from one sheet into another
    By Julyexcel124 in forum Excel Formulas & Functions
    Replies: 2
    Last Post: 11-18-2020, 07:23 PM
  4. [SOLVED] Indirect Formula to extract sheet name
    By Howardc1001 in forum Excel Formulas & Functions
    Replies: 4
    Last Post: 08-26-2019, 12:05 PM
  5. Need a Formula to extract information from one sheet to another
    By slock92 in forum Excel Formulas & Functions
    Replies: 8
    Last Post: 10-03-2016, 02:47 PM
  6. Need formula expert - Extract data from sheet 1 to sheet 2
    By stewarg66 in forum Excel Formulas & Functions
    Replies: 1
    Last Post: 03-25-2013, 02:23 AM
  7. Formula to extract data from one sheet to another
    By lstevenson in forum Excel Formulas & Functions
    Replies: 2
    Last Post: 10-09-2012, 11:10 PM

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