Results 1 to 20 of 20

Trying to modify a complex formula that outputs a spilled result in multiple columns

Threaded View

steelrends Trying to modify a complex... 11-24-2022, 05:59 AM
Glenn Kennedy Re: Trying to modify a... 11-24-2022, 06:18 AM
steelrends Re: Trying to modify a... 11-24-2022, 06:30 AM
AliGW Re: Trying to modify a... 11-24-2022, 06:42 AM
steelrends Re: Trying to modify a... 11-24-2022, 07:18 AM
steelrends Re: Trying to modify a... 11-25-2022, 12:48 AM
Glenn Kennedy Re: Trying to modify a... 11-25-2022, 04:06 AM
steelrends Re: Trying to modify a... 11-26-2022, 03:26 AM
Glenn Kennedy Re: Trying to modify a... 11-26-2022, 05:17 AM
steelrends Re: Trying to modify a... 11-26-2022, 08:38 PM
Glenn Kennedy Re: Trying to modify a... 11-27-2022, 08:51 AM
Glenn Kennedy Re: Trying to modify a... 11-27-2022, 08:54 AM
steelrends Re: Trying to modify a... 11-27-2022, 07:39 PM
Glenn Kennedy Re: Trying to modify a... 11-28-2022, 04:10 AM
steelrends Re: Trying to modify a... 11-28-2022, 06:01 AM
Glenn Kennedy Re: Trying to modify a... 11-28-2022, 07:10 AM
steelrends Re: Trying to modify a... 11-29-2022, 03:06 AM
Glenn Kennedy Re: Trying to modify a... 11-29-2022, 05:12 AM
Glenn Kennedy Re: Trying to modify a... 11-29-2022, 05:14 AM
Glenn Kennedy Re: Trying to modify a... 11-29-2022, 05:18 AM
  1. #1
    Registered User
    Join Date
    11-23-2022
    Location
    Canada
    MS-Off Ver
    Office 365
    Posts
    9

    Post Trying to modify a complex formula that outputs a spilled result in multiple columns

    Hi everyone!

    I'm working with a complex formula and trying to make some changes. See below for the formula. The formula retrieves data from an extensive drug database (20K+ lines). It then outputs a spilled result into three separate columns, which are ordered by the drug strength, pharmaceutical form, and DIN (drug identification number). See the screenshot below. I also attached some sample data with the formula.

    Screenshot.png

    I did not write this formula, so it is beyond my understanding. I'm trying to modify the formula so that it spills the 4th column for the route of administration and for this column to come after "Dosage Form" and before the "DIN/PDIN/NPN" column. The drug database I'm using contains both marketed and approved drugs. I'm also trying to get the formula to separate DINs into different columns depending on whether the product is marketed or approved. The end result would be the formula spilling out five columns. I hope what I'm asking makes sense. Let me know if you require additional clarification! I appreciate any help you can provide.

    =LET(codeList,TEXTJOIN(",",,FILTER(DPD[Drug Code],(DPD[ATC]=A5)*DPD[Number of AIS]=1)),
    codeArray,TRIM(TEXTSPLIT(codeList,"|",",")),
    formTblData,FILTER(DPD,ISNUMBER(MATCH(DPD[Drug Code]&"",codeArray,0))),
    formData,FILTER(formTblData,DPD[#Headers] = "Pharmaceutical Form"),
    formCodes,FILTER(formTblData,DPD[#Headers] = "Drug Code"),
    forms, UNIQUE(formData),
    formsCount, COUNTA(forms),
    
    
    doseTblData,FILTER(DPD,ISNUMBER(MATCH(DPD[Drug Code]&"",codeArray,0))),
    doseData,FILTER(doseTblData,DPD[#Headers] = "Dose"),
    doseCodes,FILTER(doseTblData,DPD[#Headers] = "Drug Code"),
    dose, UNIQUE(doseData),
    doseCount,COUNTA(dose),
    
    tbl,SEQUENCE(formsCount*doseCount,,0),
    dMapping,INDEX(dose,ROUNDDOWN(tbl/formsCount,0)+1),
    fMapping,INDEX(forms,MOD(tbl,formsCount)+1),
    
    fulltbl,HSTACK(dMapping,fMapping,MAP(dMapping,fMapping,LAMBDA(d,f,TEXTJOIN(", ",TRUE,TEXT(INDEX(DPD[DIN],MATCH(FILTER(doseCodes,(doseData=d)*(INDEX(formData,MATCH(doseCodes,formCodes,0))=f)*ISNUMBER(MATCH(doseCodes&"",codeArray,0))),DPD[Drug Code],0)),"00000000"))))),
    FILTER(fulltbl,NOT(ISERROR(FILTER(fulltbl,{0,0,1})))))
    Attached Files Attached Files
    Last edited by steelrends; 11-26-2022 at 03:25 AM.

Thread Information

Users Browsing this Thread

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

Similar Threads

  1. [SOLVED] MAX per row across columns with dynamically spilled array
    By Marbleking in forum Excel Formulas & Functions
    Replies: 6
    Last Post: 09-07-2022, 10:45 AM
  2. Two-way Lookup returning multiple text values (Spilled array formula)
    By DWX57 in forum Excel Formulas & Functions
    Replies: 2
    Last Post: 07-18-2022, 12:17 PM
  3. [SOLVED] Turn "spilled" formula result into text in cell
    By TheNewUnion in forum Excel Formulas & Functions
    Replies: 5
    Last Post: 03-17-2022, 06:13 AM
  4. [SOLVED] Appending more than two Columns using one Dynamic array or spilled formula.
    By kenesuino in forum Excel Formulas & Functions
    Replies: 2
    Last Post: 02-02-2022, 03:43 AM
  5. Multiple outputs from a formula
    By trf222 in forum Excel Formulas & Functions
    Replies: 3
    Last Post: 04-01-2020, 09:07 AM
  6. [SOLVED] assistance to modify complex formula from reading 30ea to 30
    By JEAN1972 in forum Excel Formulas & Functions
    Replies: 4
    Last Post: 12-08-2018, 11:09 PM
  7. Modify this complex formula using IF THEN ELSE
    By sunny17 in forum Excel Formulas & Functions
    Replies: 2
    Last Post: 07-05-2011, 10:44 AM

Tags for this Thread

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