return only values in a row

大憨熊 提交于 2019-12-13 07:17:21

问题


I have a list of unique ids and values on one sheet in excel as in the image below:

Is there a way to return only the values in the order they appear (left to right) on a separate sheet/location? For example, I would want to return for ID '1002' the values 35,32,44.. not the blanks. I am then going to turn those values into a Sparkline.

I am using excel 2010, if that makes a difference.

Thanks! Sam


回答1:


Try this formula:

=SUBSTITUTE(TRIM(B2 & " " & C2 & " " & D2 & " " & E2 & " " & F2)," ",",")


EDIT: _______________________________________________________________________________

Hope this is not too late to answer your question.

Lets assume your data is in Sheet1 as in the image below:

Now, in Cell B2 of Sheet2 enter the following formula:

=IFERROR(INDEX(Sheet1!$B2:Sheet1!$F2, SMALL(IF(ISBLANK(Sheet1!$B2:Sheet1!$F2), "", COLUMN(Sheet1!$B2:Sheet1!$F2)-MIN(COLUMN(Sheet1!$B2:Sheet1!$F2))+1), COLUMN(A1))),"")

This is an array formula so commit it by pressing Ctrl+Shift+Enter

Drag this formula across till Column F and down till Row 4 or as required. This will give you following result.

I guess this is what you are looking for.




回答2:


Based on "Concatenating Names with Delimiters" by Allen Wyatt you can use the formula below to achieve the result you wanted.

=MID(IF(B2<>"",","&B2,"")&IF(C2<>"",","& C2,"")&IF(D2<>"",","&D2,"")&IF(E2<>"",","&E2,"")&IF(F2<>"",","&F2,""),2,2000)

Regards,



来源:https://stackoverflow.com/questions/36800297/return-only-values-in-a-row

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!